카펫 - [파이썬]

Moveheon·2023년 11월 3일

프로그래머스

목록 보기
16/24
def solution(brown, yellow):
    answer = []
    mul = brown + yellow
    for i in range(1, mul):
        if mul % i == 0:
            if (i - 2) * ((mul / i) - 2) == yellow:
                if (i < mul / i):
                    answer = [int(mul / i), i]
                else:
                    answer = [i, int(mul / i)]                
                return answer
            else:
                continue
        else:
            continue
                

brown = 10
yellow = 2
print(solution(10,2))

0개의 댓글