#include <iostream>
using namespace std;
int main() {
int n, t, m=1;
ios_base::sync_with_stdio(false);
cin >> n >> t;
t%=2;
for(int i=0; i<n; ++i) m*=2;
if(t){
int * tab = new int[m];
for(int i=0; i<m; ++i)
cin >> tab[i];
for(int i=m-1; i>=0; --i)
cout << tab[i] << " ";
}
else{
for(int i=0; i<m; ++i){
cin >> t;
cout << 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 25 26 | #include <iostream> using namespace std; int main() { int n, t, m=1; ios_base::sync_with_stdio(false); cin >> n >> t; t%=2; for(int i=0; i<n; ++i) m*=2; if(t){ int * tab = new int[m]; for(int i=0; i<m; ++i) cin >> tab[i]; for(int i=m-1; i>=0; --i) cout << tab[i] << " "; } else{ for(int i=0; i<m; ++i){ cin >> t; cout << t << " "; } } return 0; } |
English