1840C - Ski Resort - CodeForces Solution


combinatorics math

Please click on ads to support us..

C++ Code:

#include <algorithm>
#include <iostream>
#include <bits/stdc++.h>
using namespace std; 
#define int long long 
signed main() {
     int t;
     cin>>t;
     while(t--){
       int n,k,q;
       cin>>n>>k>>q;
       int a[n];
       int count =0;
       int g=0;
       for(int j=0;j<n;j++){
           cin>>a[j];
       }
       
       for(int i : a){
           if(i<=q){
               count++;
           }
           else{
               count=0;
           }
           if(count>=k){
               g=g+count-k+1;
           }
       }
       cout<<g<<endl;
       
     }
	return 0;
}


Comments

Submit
0 Comments
More Questions

Almost correct bracket sequence
Count of integers
Differences of the permutations
Doctor's Secret
Back to School
I am Easy
Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup