Skip to content

Commit 8c0fe9b

Browse files
committed
1 parent 4760e07 commit 8c0fe9b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Hongjoo/lv2/카펫.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def solution(brown, yellow):
2+
sum = brown + yellow
3+
# 1. w,h in [sum의 약수 후보군]
4+
m=2
5+
li = []
6+
while m <= sum :
7+
if sum % m == 0 :
8+
li.append(m)
9+
m += 1
10+
print(li)
11+
# 2. 조건
12+
#2-1 w 가로 >= h 세로
13+
#2-2 갈색 = 2(w-1) + 2(h-1)
14+
#2-3 노란색 = (w-2) * (h-2)
15+
for w in li :
16+
for h in li:
17+
if w>=h and brown == (2*w+2*h-4) and yellow == ((w-2)*(h-2)) :
18+
answer = [w,h]
19+
return answer

0 commit comments

Comments
 (0)