Skip to content

Commit ae6cfbc

Browse files
Vishal and Girls Solution
1 parent a7c5856 commit ae6cfbc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Competitive-Programming/VishalAndGirls.py

+9
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,12 @@
2727
Explanation
2828
He can impress 4+8=12 girls if he runs at his best speed between the 2nd and the 3rd kilometre, inclusive.
2929
'''
30+
31+
for _ in range(int(input())):
32+
n,k = map(int,input().split())
33+
arr = list(map(int,input().split()))
34+
maxx = 0
35+
for i in range(n-k+1):
36+
if maxx < sum(arr[i:k+i]):
37+
maxx = sum(arr[i:k+i])
38+
print(maxx)

0 commit comments

Comments
 (0)