代码
#include <stdio.h>
int main() {
int score[101] = {0};
int n;
scanf("%d", &n);
for(int i=0; i<n; i++){
int t;
scanf("%d", &t);
score[t]++;
}
scanf("%d", &n);
for(int i=0; i<n; i++){
int t;
scanf("%d", &t);
if(i==0){
printf("%d", score[t]);
}
else{
printf(" %d", score[t]);
}
}
return 0;
}
注解
水题。
一个萝卜一个坑,一个分数占数组一个位置。