Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

why wr?thanks

Posted by found at 2008-11-26 22:37:21 on Problem 3444
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator