#include <cstdio> int main() { long n, t; scanf("%ld %ld", &n, &t); long count = 1 << n; long *values; values = new long[count]; if (t % 2 == 0){ long value; for (int i = 0; i<count; i++){ scanf(" %ld", &value); if (i==0) printf("%ld", value); else printf(" %ld", value); } } else { for (int i = 0; i<count; i++){ scanf(" %ld", &(values[i])); } for (int i = count-1; i >= 0; i--){ if (i==0) printf("%ld", values[i]); else printf("%ld ", values[i]); } } 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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #include <cstdio> int main() { long n, t; scanf("%ld %ld", &n, &t); long count = 1 << n; long *values; values = new long[count]; if (t % 2 == 0){ long value; for (int i = 0; i<count; i++){ scanf(" %ld", &value); if (i==0) printf("%ld", value); else printf(" %ld", value); } } else { for (int i = 0; i<count; i++){ scanf(" %ld", &(values[i])); } for (int i = count-1; i >= 0; i--){ if (i==0) printf("%ld", values[i]); else printf("%ld ", values[i]); } } return 0; } |