def solution(brown, yellow): answer = [] res=[] num=brown+yellow # 가능한 조합을 모두 찾아서 res에 넣음 for i in range(num,0,-1): if i<num//i: break if num%i==0: res.append((i,num//i)) for w,h in res: if (brown-(w*2-4))//2==h: answer=[w,h] break return answer