문제풀이/프로그래머스

[프로그래머스][Lv2] - 카펫(파이썬/Python)

얄루몬 2022. 1. 21. 16:22

def solution(brown, yellow):
    answer = []
    total = brown + yellow                 
    for b in range(1,total+1):
        if (total / b) % 1 == 0:            
            a = total / b
            if a >= b:                      
                if 2*a + 2*b == brown + 4:  
                    return [a,b]
            
    return answer