GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Sunday 19 June 2022

[Solution] Equal by XORing CodeChef Solution | CodeChef Problem Solution 2022


JJ has three integers AB, and N. He can apply the following operation on A:

  • Select an integer X such that 1X<N and set A:=AX. (Here,  denotes the bitwise XOR operation.)

JJ wants to make A equal to B.
Determine the minimum number of operations required to do so. Print 1 if it is not possible.

Input Format

  • The first line contains a single integer T — the number of test cases. Then the test cases follow.
Solution Click Below:-  CLICK HERE


  • The first and only line of each test case contains three integers AB, and N — the parameters mentioned in the statement.

Output Format

For each test case, output the minimum number of operations required to make A equal to B.








 Output 1 if it is not possible to do so.

Constraints

  • 1T1000
  • 0A,B<230

No comments:

Post a Comment