Advertisement
Josif_tepe

Untitled

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