Skip to content

Commit be0c501

Browse files
authored
Create Birthday_Chocolate.py
1 parent 0037a7a commit be0c501

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Birthday_Chocolate.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/python3
2+
3+
import sys
4+
5+
def getWays(squares, d, m):
6+
c = 0
7+
for i in range(len(squares)-m+1):
8+
if d == sum(squares[i:i+m]):
9+
c+=1
10+
return c
11+
12+
n = int(input().strip())
13+
s = list(map(int, input().strip().split(' ')))
14+
d,m = input().strip().split(' ')
15+
d,m = [int(d),int(m)]
16+
result = getWays(s, d, m)
17+
print(result)

0 commit comments

Comments
 (0)