Skip to content

Instantly share code, notes, and snippets.

@onikazu
Created February 11, 2020 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onikazu/322b407ca60f8c224bd2db056f178831 to your computer and use it in GitHub Desktop.
Save onikazu/322b407ca60f8c224bd2db056f178831 to your computer and use it in GitHub Desktop.
abc154 d問題
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