#include <iostream>
#include<cstdio>
#include <algorithm>
#include<vector>
using namespace std;
const int maksn=1100*1000;
int tab[maksn+20];
int potdwa(int n){
int i=1;
while(n--)
i*=2;
return i;
}
int main() {
int n, t;
scanf("%d%d",&n,&t);
n=potdwa(n);
for(int i = 0; i<n; i++){
scanf("%d",&tab[i]);
}
t%=2;
if(t) {
for (int i = n-1; i >= 0; i--) {
printf("%d%c", tab[i], ' ');
}
}else {
for (int i = 0; i < n; i++) {
printf("%d%c", tab[i], ' ');
}
}
printf("\n");
}
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 | #include <iostream> #include<cstdio> #include <algorithm> #include<vector> using namespace std; const int maksn=1100*1000; int tab[maksn+20]; int potdwa(int n){ int i=1; while(n--) i*=2; return i; } int main() { int n, t; scanf("%d%d",&n,&t); n=potdwa(n); for(int i = 0; i<n; i++){ scanf("%d",&tab[i]); } t%=2; if(t) { for (int i = n-1; i >= 0; i--) { printf("%d%c", tab[i], ' '); } }else { for (int i = 0; i < n; i++) { printf("%d%c", tab[i], ' '); } } printf("\n"); } |
English