| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
why wr?thanks#include <iostream>
using namespace std;
int main(){
int i, j, k, l, n, a[257], b[257], temp;
while( cin>>n && n ){
memset(b,0,sizeof(b));
k= n-1;
cin>> a[0];
for( i= 1; i< n; i++ ){
cin>> a[i];
a[i]= 0-a[i];
}
for( i= 2; i<= n; i*=2 ){
for( j= n-1; j>= 0; j-= i ){
for( l= 0; l< i/2; l++ )
a[k]+= (b[j-i/2-l]-b[j-l]);
a[k]= a[k]*2/i;
for( l= 0; l< i/2; l++ )
b[j-l]= b[j-l]+ a[k];
k--;
}
}
for( i= 0; i< n-1; i++ ) a[0]-= b[i];
a[0]/= n;
for( i= 0; i< n-1; i++ ) cout<< b[i]+a[0] << ' ';
cout<< b[i]+a[0] << endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator