水题,直接贴代码。
//poj 3444
//sep9
#include <iostream>
using namespace std;
const int maxN=260;
int a[maxN],b[maxN];int main()
{int i,n,m;while(scanf("%d",&n)==1&&n){for(i=1;i<=n;++i)scanf("%d",&a[i]);m=1;while(m<=n/2){for(i=1;i<=m;++i){b[2*i-1]=(a[i]+a[i+m])/2;b[2*i]=(a[i]-a[i+m])/2;} for(i=1;i<=2*m;++i)a[i]=b[i]; m*=2; }for(i=1;i<=n;++i)printf("%d ",a[i]);printf("\n");}return 0;
}