题解 | #位操作练习#右移代替左移
位操作练习
https://www.nowcoder.com/practice/7bdc346ca39841f6a05f73d98477621d
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) { // 注意 while 处理多个 case
int bo = 0;
for (int i = 0; i < 16; i++) {
if (a == b)
bo = 1;
a = a / 2 + a % 2 * pow(2, 15);
}
if (bo)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
// 64 位输出请用 printf("%lld")

查看15道真题和解析