/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 12ms 2.68 MiB
#2 Accepted 86ms 2.801 MiB
#3 Wrong Answer 1092ms 2.895 MiB

Code

import math

for _ in range(int(input())):
    x, y = map(int, input().split())
    a = min(x,y)
    if x == 1 or y == 1:
        print("-1")
    flag = 0
    for i in range(2, int(math.sqrt(a) + 1)):
        if x % i == 0 and y % i == 0:
            flag = 1
            break
    if flag:
        print(i)
    else:
        if max(x,y)%a == 0 and a != 1:
            print(a)
    

Information

Submit By
Type
Submission
Problem
P1011 LCD
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-06 20:01:36
Judged At
2024-01-06 20:01:36
Judged By
Score
50
Total Time
1092ms
Peak Memory
2.895 MiB