GUPTA MECHANICAL

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

Friday, 10 June 2022

[Solution] Reduce to zero CodeChef Solution | CodeChef Problem Solution 2022

Chef has two integers X and Y. Chef wants to perform some operations to make both X and Y zero simultaneously. In one operation, Chef can either:

  • set X:=2X
  • or set Y:=2Y
  • or set X:=X1 and Y:=Y1

Chef is a little busy with preparing the contest. Help him find the minimum number of operations required to make both X and Y equal to 0 simultaneously. If it is impossible to do so after any

    Solution Click Below:-  CLICK HERE


     number of operations, print 1.

    Input Format

    • The first line contains a single integer T — the number of test cases. Then the test cases follow.

    • The first and only line of each test case contains two space separated integers X and Y.

    Output Format

    For each test case, print the minimum number of operations required to make X and Y zero simultaneously. If it is impossible to do so after any number of operations, print 1 instead.

    Constraints

    • 1T310

    No comments:

    Post a Comment