Programmers. 카펫

hidden_·2021년 6월 10일
0

코딩테스트

목록 보기
7/10

카펫 문제 바로가기

import math

def solution(brown, yellow):
    answer = [(1, yellow)]
    for i in range(2, int(math.sqrt(yellow))+1):
        if yellow % i == 0:
            answer.append((i, yellow//i))
    for num in answer:
        s = 0
        s = num[0]*2 + num[1]*2 + 4
        if s == brown:
            return [num[1]+2, num[0]+2]
profile
steady

0개의 댓글