Advertisement
Josif_tepe

Untitled

Mar 24th, 2023
728
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <set>
  4. #include <vector>
  5.  
  6. using namespace std;
  7. typedef long long ll;
  8. int main()
  9. {
  10.     int t;
  11.     cin >> t;
  12.     while(t--) {
  13.         ll a, b;
  14.         cin >> a >> b;
  15.         ll result = 0;
  16.         for(ll i = 32; i >= 0; i--) {
  17.             if((a & (1 << i)) == (b & (1 << i))) {
  18.                 result |= (a & (1 << i));
  19.             }
  20.             else {
  21.                 break;
  22.             }
  23.         }
  24.         cout << result << endl;
  25.     }
  26.         return 0;
  27. }
  28.  
Advertisement
Comments
  • AlexHudson124
    1 year
    # text 0.28 KB | 0 0
    1. https://steamcommunity.com/profiles/76561198119200020
    2.  
    3. https://steamcommunity.com/profiles/76561198119200020
    4.  
    5. https://steamcommunity.com/profiles/76561198119200020
    6.  
    7. https://steamcommunity.com/profiles/76561198119200020
    8.  
    9. https://steamcommunity.com/profiles/76561198119200020
    10.  
    11.  
  • AlexHudson124
    1 year
    # text 0.22 KB | 0 0
    1. https://steamcommunity.com/profiles/76561198119200020
    2.  
    3. https://steamcommunity.com/profiles/76561198119200020
    4.  
    5. https://steamcommunity.com/profiles/76561198119200020
    6.  
    7. https://steamcommunity.com/profiles/76561198119200020
    8.  
    9.  
Add Comment
Please, Sign In to add comment
Advertisement