Accepted
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