#1436: AC 解答


1554942-9@g.puiching.edu.mo (S1A18梁梓皓)

School : Pui Ching Middle School
ID : 2529
IP address : [192.168.120.33]
Last Login :
2024-10-29 17:26:17
a552. 最大公因數和最小公倍數 -- GMCC 範例 | From: [192.168.120.33] | Post Date : 2024-03-15 11:38

a, b = input().split(" ")

a = int(a)
b = int(b)

def GCD(a, b):
    if b == 0:
        return a 
    else:
        return GCD(b, a%b)

def LCM(a, b):
    return abs(a * b) // GCD(a, b)

result = LCM(a, b)

print(GCD(a, b), result)


加油!!!!!!!!!
 
ZeroJudge Forum