/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 14ms 2.988 MiB
#2 Accepted 106ms 3.168 MiB
#3 Wrong Answer 1166ms 3.141 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-11-11 03:43:46
Judged By
Score
50
Total Time
1166ms
Peak Memory
3.168 MiB