#C2157. Maximum Sum in a Sliding Window
Maximum Sum in a Sliding Window
Maximum Sum in a Sliding Window
Given an array of N integers and an integer K, find the maximum sum of any contiguous subarray of size K. In other words, compute
$$ \max_{0 \leq i \leq N-K} \sum_{j=i}^{i+K-1} A_j $$
You are required to read input from standard input and output the result to standard output.
inputFormat
The first line of input contains two integers N and K separated by a space, where N is the number of elements in the array and K is the window size. The second line contains N space-separated integers representing the array elements.
outputFormat
Output a single integer that represents the maximum sum of any contiguous subarray of length K.
## sample8 3
1 3 -1 -3 5 3 6 7
16