代码:
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
const int maxn = 1010;
int main(){
int n, x, score;
// freopen("a.txt", "r", stdin);
while(cin >> n && n != 0){
int hash_score[101] = {0};
for(int i = 0; i < n; ++i){
cin >> x;
hash_score[x]++;
}
cin >> score;
cout << hash_score[score] << endl;
}
return 0;
}

本文提供了一道 NowCoder 平台上的编程题解答示例,使用 C++ 实现了通过哈希表来统计特定分数出现的次数,适用于准备考研计算机专业综合考试的同学。
1535

被折叠的 条评论
为什么被折叠?



