/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 14ms 3.129 MiB
#2 Accepted 642ms 3.277 MiB
#3 Accepted 75ms 3.074 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:58:36
Judged At
2024-11-11 03:44:44
Judged By
Score
100
Total Time
642ms
Peak Memory
3.277 MiB