Skip to content

Commit d758867

Browse files
committed
89차 2번 문제 풀이
1 parent 949df2d commit d758867

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

live8/test89/문제2/박희경.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n, m = map(int, input().split())
6+
a = list(map(int, input().split()))
7+
8+
cnt = 0
9+
i, j = 0, 0
10+
total = 0
11+
while j < n:
12+
total += a[j]
13+
while total >= m:
14+
if total == m:
15+
cnt += 1
16+
total -= a[i]
17+
i += 1
18+
j += 1
19+
20+
print(cnt)

0 commit comments

Comments
 (0)