Advertisement
Josif_tepe

Untitled

Feb 25th, 2022
1,125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, l, k;
  8.     cin >> n >> l >> k;
  9.     int niza[n];
  10.     for(int i = 0; i < n; i++)
  11.     {
  12.         cin >> niza[i];
  13.     }
  14.     int uspesni_denovi = 0;
  15.     for(int i = 0; i < n; i++)
  16.     {
  17.         if(niza[i] >= l and i + k < n)
  18.         {
  19.             int ok = 1;
  20.             for(int j = i; j <= i + k; j++)
  21.             {
  22.                 if(niza[j] < l)
  23.                 {
  24.                     ok = 0;
  25.                     break;
  26.                 }
  27.             }
  28.             if(ok == 1)
  29.             {
  30.                 uspesni_denovi++;
  31.             }
  32.         }
  33.     }
  34.     cout << uspesni_denovi << endl;
  35.     return 0;
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement