/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 12ms 2.777 MiB
#2 Accepted 614ms 3.043 MiB
#3 Accepted 57ms 3.02 MiB

Code

gcd = lambda a, b: b if a == 0 else gcd(b, a % b) if b != 0 else a
lcd = lambda a, b: -1 if (g := gcd(a, b)) == 1 else next(i for i in range(2, g + 1) if g % i == 0)
for _ in range(int(input())):
    print(lcd(*map(int, input().split())))


Information

Submit By
Type
Submission
Problem
P1011 LCD
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-01 07:51:39
Judged At
2024-01-01 07:51:39
Judged By
Score
100
Total Time
614ms
Peak Memory
3.043 MiB