Skip to content

Commit c05b745

Browse files
committed
카펫(42842) - Lv.2
1 parent f397f4b commit c05b745

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Algorithm/ProgrammersCodingTest/PythonCodingTest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3524,4 +3524,14 @@ def solution(n, lighthouse):
35243524
if onoff[now_leaf] == 1: continue
35253525
onoff[parent] = 1
35263526

3527-
return sum(onoff)
3527+
return sum(onoff)
3528+
3529+
3530+
3531+
# 카펫(42842) - Lv.2
3532+
def solution(brown, yellow):
3533+
for bh in range(1, brown//2 + 1):
3534+
bw = (brown - 2 * bh + 4) // 2
3535+
yw, yh = bw - 2, bh - 2
3536+
3537+
if yellow == yw * yh and yellow + brown == bw * bh: return [bw, bh]

0 commit comments

Comments
 (0)