Marks :10
: 12 | : 1
You are given 3 integers $$$A$$$, $$$B$$$, and $$$C$$$. You have an expression as $$$$$$((A|X)&(B|X)) = C.$$$$$$
Determine if a number X exists such that the expression holds and if it does then print the minimum value of X else print -1.
The first line contains $$$T$$$, the number of test cases. For each test case the next 3 lines contains one parameter each namely A,B and C respectively where $$$(0 \le A,B,C \le 10^9).$$$
Output the minimum value of $$$X$$$ if $$$X$$$ exists else return -1.
2 8 11 9 3 2 1
1 -1
The & (bitwise AND) in C or C++ takes two numbers as operands and does AND on every bit of two numbers. The result of AND is 1 only if both bits are 1.
The | (bitwise OR) in C or C++ takes two numbers as operands and does OR on every bit of two numbers. The result of OR is 1 if any of the two bits is 1.
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.