ji-0630 / CodingTest

코딩테스트 연습 기록
0 stars 0 forks source link

카펫 #240

Closed ji-0630 closed 1 year ago

ji-0630 commented 1 year ago

문제 설명

image image

ji-0630 commented 1 year ago

나의 풀이

import math
def solution(brown, yellow):
    po = []
    for i in range(1, int(math.sqrt(yellow))+1):
        if yellow % i == 0:
            po.append([yellow//i, i])

    for i in po:
        if brown == ((i[0]+2)*(i[1]+2)-yellow):
            return [i[0]+2, i[1]+2]