/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 13ms 2.805 MiB
#2 Accepted 620ms 3.039 MiB
#3 Accepted 59ms 3.031 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-01-09 14:19:31
Judged By
Score
100
Total Time
620ms
Peak Memory
3.039 MiB