#include <iostream>
#include <algorithm>
#include <vector>
typedef unsigned long long int ull;
using namespace std;
ull power(ull numb, ull pow)
{
ull result=1;
for(; pow; pow--)
{
result*=numb;
}
return result;
}
int main()
{
ull n, t, dwadoen, help;
vector<ull> v;
cin>>n>>t;
dwadoen=power(2, n);
for(ull i=0; i<dwadoen; i++)
{
cin>>help;
v.push_back(help);
}
if(t%2==1)
reverse(v.begin(), v.end());
for(ull i=0; i<v.size(); i++)
if(i==v.size()-1)
cout<<v[i];
else
cout<<v[i]<<" ";
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 33 34 35 36 37 38 | #include <iostream> #include <algorithm> #include <vector> typedef unsigned long long int ull; using namespace std; ull power(ull numb, ull pow) { ull result=1; for(; pow; pow--) { result*=numb; } return result; } int main() { ull n, t, dwadoen, help; vector<ull> v; cin>>n>>t; dwadoen=power(2, n); for(ull i=0; i<dwadoen; i++) { cin>>help; v.push_back(help); } if(t%2==1) reverse(v.begin(), v.end()); for(ull i=0; i<v.size(); i++) if(i==v.size()-1) cout<<v[i]; else cout<<v[i]<<" "; return 0; } |
English