BAPM - Base and Power
Little boy Arik learned exponent formulas from his math teacher. Teacher taught him, If you have such expression x^a=y^b then,
- If x=y then a=b.
- If a=b then x=y.
Arik learned this awesome thing. After a while, he was playing with different numbers. He got confused a little bit. Sometimes x not equal to y and a not equal to b but x^a=y^b. Such as 2^4=4^2. Your task is to help Arik to determine if x^a is equal to y^b or not.
Input starts with an integer T (<= 30) denoting the number of test cases.
For each case, you will given 4 integers x, a, y, b.
x and y are two bases where 0 < x, y <=100000000000001.
Two exponents are given as a and b where 0 <= a, b <= 100000000000001.
Print "Yes" without quote in a single line if x^a=y^b, "No" otherwise.
2 2 4 2 4 3 4 4 3
Easy af, AC in one go
Last edit: 2018-01-02 06:04:14
Add more tests.. My code got AC but outputs "Yes" for this case: