[Solution] Make A and B equal CodeChef Solution
Problem
Chef has two numbers and .
In one operation, Chef can choose either or and multiply it by .
Determine whether he can make both and equal after any number (possibly, zero) of moves.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of two space-separated integers and .
👇👇👇👇👇
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.
Explanation:
Test case : Chef can multiply by twice and both and will become .
Test case : Both numbers are already equal.
Test case : It can be shown that and cannot be made equal.
Test case : It can be shown that and cannot be made equal.
No comments:
Post a Comment