题目网址
https://pintia.cn/problem-sets/994805260223102976/problems/994805284092887040
思路
注意下cin会超时。
代码
#include<iostream>
#define MAX 100005
using namespace std;
int result[101] = {0};
int main() {
int n;
int k;
int index;
int cnt = 0;
int d;
// cin >> n;
scanf("%d", &n);
for (int i = 0; i < n; i ++) {
// cin >> d;
scanf("%d", &d);
result[d] ++;
}
cin >> k;
for (int i = 0; i < k; i ++) {
// cin >> d;
scanf("%d", &d);
if (i <= 0)
// cout << result[d];
printf("%d", result[d]);
else
// cout << " " << result[d];
printf(" %d", result[d]);
}
return 0;
}