先与(1010 0xaaaaaaaa)//16进制的1010/,然后0x55555555 左移,即可交换成功
`#include
using namespace std;
int main()
{
int x;
cin >> x;
int a, b;
a = x & (0xaaaaaaaa);//32位的101010...
b = x & (0x55555555);//32位的010101...
x = (a>>1) ^ (b<<1);a右移一位,b左移一位
cout << x;
return 0;
}