Created
February 11, 2020 00:45
-
-
Save onikazu/322b407ca60f8c224bd2db056f178831 to your computer and use it in GitHub Desktop.
abc154 d問題
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n, k = list(map(int, input().split())) | |
p = list(map(int, input().split())) | |
def expect(n): | |
res = (n + 1) / 2 | |
return res | |
p = list(map(expect, p)) | |
ans_sum = sum(p[:k]) | |
tmp_sum = ans_sum | |
idx = 0 | |
for i in range(k, n): | |
tmp_sum = tmp_sum + p[i] - p[i-k] | |
if tmp_sum > ans_sum: | |
ans_sum = tmp_sum | |
print(ans_sum) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment