#include <stdio.h> int main(void) { unsigned int n,t,i=0,k,z,w; unsigned int p[1048576]; scanf("%u %u",&n,&t); k=1<<n; z=t%2?k-1:0; w=t%2?-1:1; for(;i<k;++i) { scanf("%u",p+z+w*i); } for(i=0;i<k;++i) { printf("%u ", *(p+i)); } printf("\n"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <stdio.h> int main(void) { unsigned int n,t,i=0,k,z,w; unsigned int p[1048576]; scanf("%u %u",&n,&t); k=1<<n; z=t%2?k-1:0; w=t%2?-1:1; for(;i<k;++i) { scanf("%u",p+z+w*i); } for(i=0;i<k;++i) { printf("%u ", *(p+i)); } printf("\n"); return 0; } |