The product mystery solution codechef
For Solution
Click Here!
Given two constructive numbers BB and CC, what’s the minimal constructive worth of AA, such that A⋅BA⋅B is divisible by CC.
Right here, A⋅BA⋅B denotes the worth obtained when AA is multiplied by BB.
Enter Format
The product mystery solution codechef
- The first line will include an integer TT – variety of take a look at circumstances. Then the take a look at circumstances observe.
- The first and solely line of every take a look at case incorporates two integers BB and CC.
Output Format
For every take a look at case, output the minimal worth of AA such that A⋅BA⋅B is divisible by CC.
Constraints
- 1≤T≤1051≤T≤105
- 1≤B,C≤1091≤B,C≤109
Pattern Enter 1
The product mystery solution codechef
2
2 4
8 12
Pattern Output 1
2
3
Rationalization
The product mystery solution codechef
Check case 11: We now have B=2B=2 and C=4C=4. If we select A=2A=2, then A⋅B=4A⋅B=4, which is divisible by 44. Be aware that that is minimal constructive worth of AA, such that A⋅BA⋅B is divisible by CC.
Check case 22: We now have B=8B=8 and C=12C=12. If we select A=3A=3, then A⋅B=24A⋅B=24, which is divisible by 1212. Be aware that that is minimal constructive worth of AA, such that A⋅BA⋅B is divisible by CC.