文章

85

粉丝

0

获赞

579

访问

16.2k

头像
统计同成绩学生人数 题解:
P1329 浙江大学机试题
发布于2026年3月6日 17:19
阅读数 61

#include <bits/stdc++.h>
using namespace std;

int main () {
    int n;
    while (cin >> n&&n!=0) {
        map<int,int > mp;
        int score;
        for (int i=0;i<n;i++) {
            cin >> score;
            mp[score]++;
        }
        int target;
        cin >> target;
        bool flag=false;
        for (auto i:mp) {
            if (i.first == target) {
                cout << i.second << endl;
                flag=true;
            }
        }
        if (flag==false) {
            cout << target << endl;
        }

    }
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发