/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 3.02 MiB
#2 Accepted 671ms 3.297 MiB
#3 Accepted 77ms 3.211 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-09 14:19:31
Judged At
2024-11-11 03:43:36
Judged By
Score
100
Total Time
671ms
Peak Memory
3.297 MiB