Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Given an array of ~ N ~ positive integers ~ a_1, a_2, \ldots, a_N ~ and a positive integer ~ K ~. Select ~K ~ consecutive elements such that their sum is the largest. Print that value.
Input
- Line ~1~: Two positive integers ~ N ~ and ~ K ~ (~ K \leq N \leq 10^5 ~).
- Line ~2~: ~N ~ positive integers ~ a_1, a_2, \ldots, a_N ~ (~ a_i \leq 10^9 ~).
Output
- Print the value that satisfies the problem's requirement.
Sample Input
6 2
2 4 5 2 9 1
Sample Output
11
Bình luận