fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7.  
  8. int array[n];
  9. for (int i = 0; i < n; i++) {
  10. cin >> array[i];
  11. }
  12.  
  13. int q;
  14. cin >> q;
  15.  
  16. for (int i = 0; i < q; i++) {
  17. int query;
  18. cin >> query;
  19.  
  20. int count = 0;
  21. for (int j = 0; j < n; j++) {
  22. if (array[j] == query) {
  23. count++;
  24. }
  25. }
  26. cout << count <<" ";
  27. }
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5328KB
stdin
Standard input is empty
stdout
Standard output is empty