题解 | #统计同成绩学生人数#
统计同成绩学生人数
https://www.nowcoder.com/practice/987123efea5f43709f31ad79a318ca69
//土尔逊Torson 编写于2023/06/14
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <map>
using namespace std;
int main() {
int n;
while (scanf("%d", &n) != EOF) {
if (0 == n) {
break;
}
map<int, int> score;
for (int i = 0; i < n; ++i) {
int num;
scanf("%d", &num);
score[num]++;
}
int key;
scanf("%d", &key);
printf("%d\n", score[key]);
}
system("pause");
return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")
查看17道真题和解析