Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- ifstream cin("input.txt");
- int n;
- cin>>n;
- vector<double> v1;
- for(int i = 0; i < n; i++){
- v1.push_back(0);
- cin>>v1[i];
- }
- sort(v1.begin(), v1.end());
- int m;
- cin>>m;
- double ai, bi;
- int c;
- for(int i = 0; i < m; i++)
- {
- cin>>ai>>bi;
- c = 0;
- auto low = lower_bound(v1.begin(), v1.end(), ai), up = upper_bound(v1.begin(), v1.end(), bi);
- for(auto vi = low; vi != up; ++vi)
- c++;
- cout<<c<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement