文章

38

粉丝

11

获赞

2

访问

17.4k

头像
map解法
P1177 北京大学上机题
发布于2024年8月30日 16:20
阅读数 648

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    while(cin >> n >> m){
        map<int,int> mp;
        int a[n] ;
        int x;
        for(int i = 0;i < n;i++){
            cin >> a[i];
            mp[a[i]]++;

        }
        for(int i = 0;i < n;i++){
            if(mp[a[i]] > 1) cout << mp[a[i]] - 1 << endl;
            else cout << "BeiJu" << endl;
        }

    }
    return 0;
}
 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发