ALGOQ006-Editorial

PROBLEM NAME:

BINARY

PROBLEM LINK:

(CodeChef: Practical coding for everyone)

DIFFICULTY:

BEGINNER

PREREQUISITES:

BIT MANIPULATION

SOLUTION:

In this, we need to find the number whose every bit is the least significant bit of every substring starting with the most significant bit i.e. we just need to find bitwise XOR of given numbers.

#include <iostream>
#include <string>
#define ll long long int
using namespace std;
 
int main() {
int tc;
cin>>tc;
while(tc-->0){
   ll a,b;
   cin>>a>>b;
   ll ans=a^b;
   cout<<ans<<"\n";
 
}
	return 0;
}