Programming/Python & Data Structures
[Baekjoon/Python3] 14490번 백대열
HooNeee
2020. 12. 7. 02:58
[Baekjoon/Python3] 14490번 백대열
14490번: 백대열
n과 m이 :을 사이에 두고 주어진다. (1 <= n, m <= 100,000,000)
www.acmicpc.net
def gdc(a, b):
if b % a:
return gdc(b % a, a)
else:
return a
n, m = map(int, input().split(':'))
g = gdc(n, m)
print('{}:{}'.format(n // g, m // g))