완전탐색1 [프로그래머스] 카펫 파이썬 완전탐색으로 푸는 방법 def solution(brown, red): for a in range(1, int(red**0.5)+1): if not red % a: b = red // a if 2*a + 2*b + 4 == brown: return [b+2, a+2] 출처: geonlee.tistory.com/114 def solution(brown, red): for index in range(1,red+1): if red%index == 0: length = red//index if (((index+2)*(length+2))-(index*length)) == brown: return [max(index+2,length+2),min(index+2,length+2)] m.blog.naver.com/Post.. 2021. 3. 12. 이전 1 다음