#include <iostream> using namespace std; int A[1500000]; int tab[21]= {0,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576}; int main() { int n,t; cin>>n>>t; for(int i=0; i<tab[n]; i++) cin>>A[i]; if(t%2==0) { for(int i=0; i<tab[n]; i++) cout<<A[i]<<" "; } else { for(int i=0; i<tab[n]/2; i++) { swap(A[i],A[tab[n]-i-1]); } for(int i=0; i<tab[n]; i++) cout<<A[i]<<" "; } }
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 | #include <iostream> using namespace std; int A[1500000]; int tab[21]= {0,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576}; int main() { int n,t; cin>>n>>t; for(int i=0; i<tab[n]; i++) cin>>A[i]; if(t%2==0) { for(int i=0; i<tab[n]; i++) cout<<A[i]<<" "; } else { for(int i=0; i<tab[n]/2; i++) { swap(A[i],A[tab[n]-i-1]); } for(int i=0; i<tab[n]; i++) cout<<A[i]<<" "; } } |