文章

38

粉丝

11

获赞

2

访问

17.4k

头像
谁是你的潜在朋友 题解:
P1225 北京大学机考题
发布于2024年9月17日 11:54
阅读数 169

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    int x;
    map<int,int> book;
    vector<int> a;
    for(int i = 1;i <= n;i++){
        cin >> x;
        a.push_back(x);
        book[x]++;
    }
    for(int i = 0;i < n;i++){
        if(book[a[i]] > 1) cout << book[a[i]] - 1 << endl;
        else cout << "BeiJu" << endl;
    }
    return 0;
}
 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发