Skip to content

Commit 92cb7f1

Browse files
committed
96차 2번 문제 풀이
1 parent 66eec4d commit 92cb7f1

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

live9/test96/문제2/박희경.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def solution(n):
2+
answer = 0
3+
4+
start, end = 1, 1
5+
total = 1
6+
while end <= n:
7+
if total == n:
8+
answer += 1
9+
end += 1
10+
total += end
11+
elif total < n:
12+
end += 1
13+
total += end
14+
else:
15+
total -= start
16+
start += 1
17+
18+
return answer

0 commit comments

Comments
 (0)