文章

74

粉丝

0

获赞

111

访问

9.0k

头像
统计同成绩学生人数 题解:
P1329 浙江大学机试题
发布于2026年2月9日 11:46
阅读数 33

#include<iostream>
#include<unordered_map>

using namespace std;

int main() {
	int n;
	while (cin >> n && n != 0) {
		unordered_map<int, int> mp;
		while (n -- ) {
			int x;
			cin >> x;
			mp[x] ++ ;
		}
		int score;
		cin >> score;
		auto it = mp.find(score);
		if (it != mp.end()) {
			cout << mp[score] << endl;
		} else {
		    cout << '0' << endl;
		}
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发