#include <stdio.h> int main() { unsigned tab[1u << 20]; unsigned n, t; scanf("%u %u\n", &n, &t); n = 1u << n; t = t & 1; for (unsigned i=0; i<n; ++i) scanf("%u", tab+i); for (unsigned i=0; i<n; ++i) printf("%u ", tab[t?(n-i-1):i]); printf("\n"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <stdio.h> int main() { unsigned tab[1u << 20]; unsigned n, t; scanf("%u %u\n", &n, &t); n = 1u << n; t = t & 1; for (unsigned i=0; i<n; ++i) scanf("%u", tab+i); for (unsigned i=0; i<n; ++i) printf("%u ", tab[t?(n-i-1):i]); printf("\n"); return 0; } |