fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. int n = 9 ;
  5. int a[9] = {1,3,3,4,1,4,4,4,4};
  6. map <int,int> b ;
  7. for(auto x:a)b[x]++;
  8.  
  9. int queries[3] = {3,4,1};
  10. int q = 3 ;
  11. int j = 0 ;
  12. while(j<q){
  13. int x = queries[j] ;
  14. cout<<b[x];
  15. cout<<' ';
  16. j++;
  17. }
  18. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
2 5 2