The world gave me the eyes to find the light but let me grope in the dark I'm not a bad guy, but I can't be a good guy.
Xu Yu A variety of bored, then turned up a math book looked up the series
A series of length n, he wrote down a number m, he wanted to know how many intervals in the sequence of the number of K-large numbers not less than m, of course, first of all, the interval must have at least K number
Input
The first number indicates a T group case
Then there's n,m,k.
Finally there is an array of length n (0<n<10000) (k>0) (0<m<n)
Output
For each set of data output a single number represents the answer.
#include <cstdio>#include<cstring>#include<queue>#include<vector>#include<algorithm>#include<iostream>#include<math.h>using namespacestd;#defineLL Long Long#defineINF 0x3f3f3f3f#defineN 10009intA[n],q[n],qq[n];intMain () {intt,n,m,k; scanf ("%d",&T); while(t--) {scanf ("%d%d%d",&n,&m,&k); for(intI=1; i<=n;i++) scanf ("%d",&A[i]); intans=0, sum=0; for(intI=1; i<=n;i++) { if(a[i]>=m) {Q[i]=q[i-1]+1; qq[++ans]=i; } ElseQ[i]=q[i-1]; if(q[i]>=k) Sum+=qq[q[i]-k+1]; } printf ("%d\n", sum); } return 0;}
Prepare for a future No.3 how many of the consecutive substrings meet the number of k greater than or equal to M