#include <stdio.h> #include <inttypes.h> #define I32 int32_t I32 n, m, k, i, j, _t; I32 tab[1148576];//1<<20+10]; int main(int argc, char **argv) { scanf("%"SCNi32"%"SCNi32, &n, &k); m=1<<n; if (k&1){ for (i=0; i<m; ++i) scanf("%"SCNi32, &tab[i]); for (i=m; i>0; --i) printf("%"PRIi32" ", tab[i-1]); }else{ for (i=0; i<m; ++i){ scanf("%"SCNi32, &_t); printf("%"PRIi32" ", _t); } } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <stdio.h> #include <inttypes.h> #define I32 int32_t I32 n, m, k, i, j, _t; I32 tab[1148576];//1<<20+10]; int main(int argc, char **argv) { scanf("%"SCNi32"%"SCNi32, &n, &k); m=1<<n; if (k&1){ for (i=0; i<m; ++i) scanf("%"SCNi32, &tab[i]); for (i=m; i>0; --i) printf("%"PRIi32" ", tab[i-1]); }else{ for (i=0; i<m; ++i){ scanf("%"SCNi32, &_t); printf("%"PRIi32" ", _t); } } return 0; } |