Language/Python

[Python / 프로그래머스 level 2] 카펫

ej503 2021. 8. 10. 09:08

def solution(brown, yellow):
    s = brown + yellow
    for longth in range(s,2,-1):
        if s % longth == 0:
            length = s // longth
            if yellow  == (longth - 2) * (length - 2):
                return [longth, length]