#include <iostream> using namespace std; int main(int argc, char * argv[]) { int n, t; cin >> n >> t; int count = 1 << n; if(t % 2) { int * buf = new int[count]; for(int i = 0; i < count; i++) cin >> buf[i]; for(int i = count - 1; i >= 0; i--) cout << buf[i] << " "; delete [] buf; buf = 0; } else { for(int i = 0; i < count; i++) { int number; cin >> number; cout << number << " "; } } 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 | #include <iostream> using namespace std; int main(int argc, char * argv[]) { int n, t; cin >> n >> t; int count = 1 << n; if(t % 2) { int * buf = new int[count]; for(int i = 0; i < count; i++) cin >> buf[i]; for(int i = count - 1; i >= 0; i--) cout << buf[i] << " "; delete [] buf; buf = 0; } else { for(int i = 0; i < count; i++) { int number; cin >> number; cout << number << " "; } } return 0; } |