Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int maxn=200005;
- typedef long long ll;
- int main()
- {
- int n;
- cin >> n;
- for(int y = 0; y < n; y++) {
- ll a, b;
- cin >> a >> b;
- ll result = 0;
- for(ll i = 32; i >= 0; i--) {
- if((a & (1LL << i)) == (b & (1LL << i))) {
- result |= (a & (1LL << i));
- }
- else {
- break;
- }
- }
- cout << result << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement