Accepted
Code
import math
for _ in range(int(input())):
x, y = map(int, input().split())
a = min(x,y)
flag = 0
for i in range(2, int(math.sqrt(a) + 1)):
if x % i == 0 and y % i == 0:
print(i)
flag = 1
continue
if flag:
continue
if max(x,y)%a == 0 and a != 1:
print(a)
continue
print(-1)
Information
- Submit By
- Type
- Submission
- Problem
- P1011 LCD
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-01-06 20:05:45
- Judged At
- 2024-11-11 03:43:46
- Judged By
- Score
- 100
- Total Time
- 1232ms
- Peak Memory
- 3.168 MiB