Notice
Hash散列
#include <iostream>
using namespace std;
int a[110] = {0}; //开一个Hash表,记录各个分数的人数
int main (){
int n,k,score;
cin >> n;
for(int i = 0;i < n;i++){
//cin >> score;
scanf("%d",&score); //输入改为scanf可以缩短耗时
a[score]++;
}
cin >> k;
for(int i = 0;i < k;i++){
// cin >> score;
scanf("%d",&score);
if(i != 0)cout << " ";
// cout << a[score];
printf("%d",a[score]);
}
return 0;
}