/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 15ms 3.008 MiB
#2 Wrong Answer 16ms 2.934 MiB

Code

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def find_gcm_less_than_x(a, b, c, x):
    gcd_ab = gcd(a, b)
    gcm = (gcd(gcd_ab, c))
    
    if gcm < x:
        return gcm
    else:
        return -1

def main():
    T = int(input())
    for _ in range(T):
        a, b, c, x = map(int, input().split())
        result = find_gcm_less_than_x(a, b, c, x)
        print(result)

if __name__ == "__main__":
    main()

Information

Submit By
Type
Submission
Problem
P1025 GCM
Contest
Brain booster #2
Language
Python 3 (Python 3.12.3)
Submit At
2024-03-06 16:58:17
Judged At
2024-11-11 03:41:09
Judged By
Score
0
Total Time
16ms
Peak Memory
3.008 MiB