Advertisement
Josif_tepe

Untitled

Dec 16th, 2022
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <stack>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int n;
  10.     cin >> n;
  11.    
  12.     int niza[n];
  13.     for(int i = 0; i < n; i++) {
  14.         cin >> niza[i];
  15.     }
  16.    
  17.     sort(niza, niza + n);
  18.    
  19.     int indeks = upper_bound(niza, niza + n, 30) - niza;
  20.     cout << indeks << endl;
  21.     return 0;
  22. }
  23. /*
  24. 5
  25. 10 20 30 30 50
  26.  
  27.  ni vraka indeks 4
  28. */
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement