Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int n, q, tmp;
  8. vector<int> a;
  9.  
  10. int main()
  11. {
  12.     ios_base::sync_with_stdio(0);
  13.     cin.tie(0);
  14.     cin >> n;
  15.     for (int i = 0; i < n; ++i) {
  16.         cin >> tmp;
  17.         a.push_back(tmp);
  18.     }
  19.     cin >> q;
  20.     while (q--) {
  21.           cin >> tmp;
  22.           cout<<upper_bound(a.begin(), a.end(), tmp) - lower_bound(a.begin(), a.end(), tmp)<<"\n";
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement