☁️정리/❄️알고리즘
[Algorithm] 최소공배수, 최대공약수
뿌야._.
2021. 8. 23. 23:35
🙄 최대 공약수 GCD(Greatest Common Divisor)
🙄 최소 공배수 LCM(Least Common Multiple)
def gcd(a,b): #최대공약수
if b==0:
return a
return gcd(b,a%b)
if __name__=='__main__' :
A,B=map(int, input().split())
print(int(A*B/gcd(A,B))) #최소공배수