Published August 13, 2022 by

Make A and B equal CodeChef - Java Code EQUALISE

 Make A and B equal CodeChef Java Code EQUALISE

Problem Code: EQUALISE


Problem:

  • Chef has two numbers AA and BB.
  • In one operation, Chef can choose either AA or BB and multiply it by 22.
  • Determine whether he can make both AA and BB equal after any number (possibly, zero) of moves.


Input Format:

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of two space-separated integers AA and BB.

Output Format:

  • For each test case, output YES if Chef can make both numbers equal, NO otherwise.
  • Note that the checker is case-insensitive i.e. YES, Yes, yes, yES are all considered same.






Constraints:
  • 1<=T<=2500
  • 1<=A,B<=50
INPUTS: 
  • 4
  • 5 20
  • 6 6
  • 12 2
  • 50 20






OUTPUT:
  • YES
  • YES
  • NO
  • NO
Explanation:
  • Test case 1: The chef can multiply AA by 22 twice and both AA and BB will become 2020.
  • Test case 2: Both numbers are already equal.
  • Test case 3: It can be shown that AA and BB cannot be made equal.
  • Test case 4: It can be shown that AA and BB cannot be made equal.





Make A and B equal CodeChef Java Code EQUALISE



For more related, Codechef, Search the keyword in Search Bar






Thank You