P1100 高低位交换
unsigned int n;
string a;
int main()
{
cin>>n;
while(n)
{
a+='0'+n%2;
n/=2;
}
while(a.size()<32) a+='0';
reverse(a.begin(),a.end());
string a1=a.substr(0,16);
string a2=a.substr(16,16);
string b=a2+a1;
unsigned int res=0;
for(int i=0;i<b.size();i++) res=res*2+b[i]-'0';
cout<<res<<endl;
//system("pause");
}
题解区大佬代码,感觉被吊打了
const int N=1e5+10;
unsigned int n;
int main()
{
cin>>n;
cout<<(n<<16|n>>16)<<endl;
//system("pause");
}