Skip to content

Commit 0b42dbb

Browse files
author
hangyeol
committed
96차 2번 문제 풀이
1 parent f94ec7c commit 0b42dbb

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+
start, end = 1, 1
3+
current_sum = 1
4+
count = 0
5+
6+
while start <= n:
7+
if current_sum == n:
8+
count += 1
9+
current_sum -= start
10+
start += 1
11+
elif current_sum < n:
12+
end += 1
13+
current_sum += end
14+
else:
15+
current_sum -= start
16+
start += 1
17+
18+
return count

0 commit comments

Comments
 (0)