Windows Reaching the Target
Count how many contiguous windows of exactly K elements have a sum of at least T.
Input: the first line has N, K and T; the second line has N integers.
Output: the number of windows with sum ≥ T.
Constraints:
- 1 ≤ K ≤ N ≤ 105
- −50 ≤ ai ≤ 50
- |T| ≤ 5×106
Sample Tests
Input 1
5 2 4 1 3 2 4 1
Output 1
4
Input 2
2 1 0 -1 1
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.