WPC5I - LCM
Given n, and m, find the smallest k such that -
n divides lcm (m,k) ; m divides lcm (n,k)
Even if there are no Galactic Wars, you are still a Martian. Just do it.
First line contains a single integer T, denoting the number of Test Cases.
T lines containing space separated integers: m and n
Output T lines each containing the smallest k that satisfies the problem
1 <= T <= 2000
1 <= m,n < 2^31
Time Limit: 1 second
Nice problem my 100th :)
0.0 AC felling happy!
brute force works
Good Problem...............AC in one go :)
@Lakshman why is 782 wrong?
@Saurabh Jain: Yes I am.
@Lakshman are you sure that he answer is 1564 for the testcase you provided, I find 782 to work as well and my prog actually gives that output.