Files
python/TangDou/LuoGuBook/P1100.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

18 lines
493 B
C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
//取第k位
LL x;
cin >> x;
//& 0x0000ffff 是清空了前十六位
//& 0xffff0000 是清空了后十六位
// <<16 就把清空的前十六位整没了
// >>16 就把清空的后十六位整没了
// 两者再或一下,就是前后颠倒过来了
cout << ((x & 0x0000ffff) << 16 | (x & 0xffff0000) >> 16) << endl;//万无一失的做法
return 0;
}