Advertisement
Spidey2182

XOR - SUM O(m) (C++)

Jul 5th, 2023
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     int m, n;
  5.     cin >> m >> n;
  6.    
  7.     for(int i = 0; i <= m; i++) {
  8.         if((i ^ (m - i)) == n) {
  9.             cout << 1;
  10.             return 0;
  11.         }
  12.     }
  13.  
  14.     cout << 0;
  15.     return 0;
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement