AtCoder Beginner Contest 130
D
Enough Array
AtCoder
⌀ 865
原题
← CE →
翻译中…

Problem Statement

翻译中…

You are given a sequence of positive integers of length $N$, $A=a_1,a_2,…,a_{N}$, and an integer $K$. How many contiguous subsequences of $A$ satisfy the following condition?

翻译中…
  • (Condition) The sum of the elements in the contiguous subsequence is at least $K$.
翻译中…

We consider two contiguous subsequences different if they derive from different positions in $A$, even if they are the same in content.

翻译中…

Note that the answer may not fit into a $32$-bit integer type.

翻译中…

Constraints

翻译中…
  • $1 \leq a_i \leq 10^5$
  • $1 \leq N \leq 10^5$
  • $1 \leq K \leq 10^{10}$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N K
a_1 a_2 ... a_N

翻译中…

Output

翻译中…

Print the number of contiguous subsequences of $A$ that satisfy the condition.

翻译中…

样例

Input #1
4 10
6 1 2 7
Output #1
2
The following two contiguous subsequences satisfy the condition: - $A[1..4]=a_1,a_2,a_3,a_4$, with the sum of $16$ - $A[2..4]=a_2,a_3,a_4$, with the sum of $10$
Input #2
3 5
3 3 3
Output #2
3
Note again that we consider two contiguous subsequences different if they derive from different positions, even if they are the same in content.
Input #3
10 53462
103 35322 232 342 21099 90000 18843 9010 35221 19352
Output #3
36
题目信息
题号
abc130_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。