mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 20:48:48 +00:00
D - Zookeeper and The Infinite Zoo
https://codeforces.com/contest/1491/submission/179545851
This commit is contained in:
parent
e15651066a
commit
a041302b0d
38
Codeforces/1491/D/D.cpp
Normal file
38
Codeforces/1491/D/D.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user