//2603529 2011-07-28 15:56:55 Accepted 2892 C 220 160 ylwh!
//2603528 2011-07-28 15:56:00 Presentation Error 2892 C 210 160 ylwh!
#include <stdio.h>
int main()
{
int n, s[2][257], i, k, temp;
while(scanf("%d", &n) && n)
{
k = 1;
for(i=0; i<n; i++)
{
scanf("%d", &s[0][i]);
s[1][i] = s[0][i];
}
temp = 1;
while(temp <= n/2)
{
for(i = 0; i < temp; i++)
{
s[k][i*2] = ( s[!k][i] + s[!k][i + temp] ) / 2 ;
s[k][i*2+1] = ( s[!k][i] - s[!k][i + temp] ) / 2;
}
temp *= 2;
k = (k+1) % 2;
}
k = (k+1) % 2;
for(i=0; i<n; i++)
{
printf("%d", s[k][i]);
if(i!= n-1)printf(" ");
}
printf("\n");
}
return 0;
}
zoj 2892 Wavelet Compression
最新推荐文章于 2019-01-06 16:09:43 发布