luogu#P2717. 寒假作业
寒假作业
Background
zzs and zzy are being tormented by their winter vacation homework, but they have answers they can copy.
Problem Description
They have pieces of winter vacation homework. For each piece, zzy defined a fatigue value , representing the effort required to copy that assignment.
zzs wants to know how many contiguous groups of assignments have an average fatigue value not less than .
In short, given a positive integer sequence of length , , count the number of contiguous subarrays whose average is not less than .
Input Format
The first line contains two integers, the sequence length and the given parameter .
The second line contains integers, where the -th integer is .
Output Format
Output one line with a single integer representing the answer.
3 2
1
2
3
4
Hint
Sample 1 Explanation
There are contiguous subarrays: , , , , , . Their averages are , , , , , . Among them, there are whose average is not less than .
Constraints
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that , .
Translated by ChatGPT 5