[Programmers] - 멀쩡한 사각형 (Level 2)


Summer/Winter Coding(2019)
LEVEL : 2
문제링크

w = 8
h = 12
def solution(w,h):

    m = max(w,h)
    n = min(w,h)

    while True:
        tmp = m % n
        if tmp == 0:
            gcd = n
            break
        m, n = max(n,tmp), min(n,tmp)

    return w*h - (w+h-gcd)
solution(w,h)
80

Comments