You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
493 B
18 lines
493 B
#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;
|
|
} |