100 atcoder#ABC130D. [ABC130D] Enough Array
[ABC130D] Enough Array
Score : points
Problem Statement
You are given a sequence of positive integers of length , , and an integer . How many contiguous subsequences of satisfy the following condition?
- (Condition) The sum of the elements in the contiguous subsequence is at least .
We consider two contiguous subsequences different if they derive from different positions in , even if they are the same in content.
Note that the answer may not fit into a -bit integer type.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the number of contiguous subsequences of that satisfy the condition.
4 10
6 1 2 7
2
The following two contiguous subsequences satisfy the condition:
- , with the sum of
- , with the sum of
3 5
3 3 3
3
Note again that we consider two contiguous subsequences different if they derive from different positions, even if they are the same in content.
10 53462
103 35322 232 342 21099 90000 18843 9010 35221 19352
36