Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- vector<int> vec;
- int n;
- cin >> n;
- for(int i = 0;i < n;++i)
- {
- int a;
- cin >> a;
- vec.push_back(a);
- }
- sort(vec.begin(), vec.end());
- int q;
- cin >> q;
- while(q--)
- {
- int x;
- cin >> x;
- cout << lower_bound(vec.begin(), vec.end(), x) - vec.begin() << endl;//lower_bound() - знаходить перший елемент масиву, який менший за задане значення х,
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement