Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <set>
- #include <vector>
- using namespace std;
- typedef long long ll;
- int main()
- {
- int t;
- cin >> t;
- while(t--) {
- ll a, b;
- cin >> a >> b;
- ll result = 0;
- for(ll i = 32; i >= 0; i--) {
- if((a & (1 << i)) == (b & (1 << i))) {
- result |= (a & (1 << i));
- }
- else {
- break;
- }
- }
- cout << result << endl;
- }
- return 0;
- }
Advertisement
Comments
-
- https://steamcommunity.com/profiles/76561198119200020
- https://steamcommunity.com/profiles/76561198119200020
- https://steamcommunity.com/profiles/76561198119200020
- https://steamcommunity.com/profiles/76561198119200020
- https://steamcommunity.com/profiles/76561198119200020
-
- https://steamcommunity.com/profiles/76561198119200020
- https://steamcommunity.com/profiles/76561198119200020
- https://steamcommunity.com/profiles/76561198119200020
- https://steamcommunity.com/profiles/76561198119200020
Add Comment
Please, Sign In to add comment
Advertisement