Advertisement
Josif_tepe

Untitled

Dec 2nd, 2022
791
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n;
  9.     cin >> n;
  10.    
  11.     vector<int> v;
  12.     for(int i = 0; i < n; i++) {
  13.         int broj;
  14.         cin >> broj;
  15.         v.push_back(broj);
  16.     }
  17.     int x;
  18.     cin >> x;
  19.     sort(v.begin(), v.end());
  20.    
  21.     int pozicija = lower_bound(v.begin(), v.end(), x) - v.begin();
  22.    
  23.     cout << pozicija + 1 << endl;
  24.    return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement