#include<cstdio> #include<vector> using namespace std; int main() { int n,d,i; scanf("%d%d",&n,&d); n=1<<n; if(d%2) { vector<int> t(n); for(i=0;i<n;++i) scanf("%d",&t[i]); while(n--) printf("%d ",t[n]); } else for(i=0;i<n;++i) { scanf("%d",&d); printf("%d ",d); } 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 | #include<cstdio> #include<vector> using namespace std; int main() { int n,d,i; scanf("%d%d",&n,&d); n=1<<n; if(d%2) { vector<int> t(n); for(i=0;i<n;++i) scanf("%d",&t[i]); while(n--) printf("%d ",t[n]); } else for(i=0;i<n;++i) { scanf("%d",&d); printf("%d ",d); } return 0; } |