[Baekjoon] 백준 21921 블로그 Python
·
🔻PS/Baekjoon
https://www.acmicpc.net/problem/21921 import sysinput = sys.stdin.readlinen, x = map(int, input().split(" "))arr = list(map(int, input().split(" ")))prefix = [0 for _ in range(n)]prefix[0] = arr[0]max_val = 0cnt = 0for i in range(1, n): prefix[i] = prefix[i-1] + arr[i]prefix = [0] +prefixfor i in range(n, -1, -1): hap = prefix[i] - prefix[i-x] if hap > max_val: max_val = hap ..