LCD
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 3.0 s
Memory Limit: 64.0 MB
Description
Lets define LCD as lowest common divisor (greater than 1) of any two number.
You are given two positive number n and m. find the LCD of n and m.
or report that there are no LCD between n and m.
for example : LCD of 20 and 50 is 2 ( 2 is the lowest number(LCD != 1) which is the divisor of both 20 and 50)
Input
First line will contain an integer T : number of testcases
each of next T lines will contain two positive integers n,m ;
1<= T <= \(10^4\)
1<= N,M <= \(10^6\)
Output
print T lines , each line should contain an integer, the LCD of n and m.
if there is no LCD print -1
Sample
Input | Output |
---|---|
|
|
Brain booster - 1
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 10
- Start at
- 2023-12-31 13:15
- End at
- 2023-12-31 17:15
- Duration
- 4.0 hour(s)
- Host
- Partic.
- 36