mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-26 08:12:01 +00:00
39 lines
624 B
C++
39 lines
624 B
C++
|
#include <iostream>
|
||
|
|
||
|
using std::cin;
|
||
|
using std::cout;
|
||
|
const char endl = '\n';
|
||
|
|
||
|
int main() {
|
||
|
std::ios::sync_with_stdio(false);
|
||
|
cin.tie(nullptr);
|
||
|
|
||
|
int q;
|
||
|
|
||
|
cin >> q;
|
||
|
|
||
|
while (q--) {
|
||
|
unsigned int u, v;
|
||
|
int cnt_u = 0,
|
||
|
cnt_v = 0;
|
||
|
|
||
|
cin >> u >> v;
|
||
|
|
||
|
bool flag = u <= v;
|
||
|
for (int i = 0; i < 30; i++) {
|
||
|
if (u & (1 << i)) cnt_u++;
|
||
|
if (v & (1 << i)) cnt_v++;
|
||
|
|
||
|
if (cnt_u < cnt_v) {
|
||
|
flag = false;
|
||
|
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
cout << (flag ? "YES" : "NO") << endl;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|