题解 | 数组计数维护
数组计数维护
https://www.nowcoder.com/practice/47ee4c040f1648fc9ef7732d35402676
import sys
n1 = int(input())
for i in range(n1):
s = cnt = 0
n,k = map(int, input().strip().split())
a = list(map(int,input().strip().split()))
for j in range(n):
if a[j]>= k:
s = s + a[j]
elif a[j] == 0 and s>=1:
s = s -1
cnt = cnt +1
else:
continue
print(cnt)