题解 | #谁是你的潜在朋友#
谁是你的潜在朋友
https://www.nowcoder.com/practice/0177394fb25b42b48657bc2b1c6f9fcc
#include <iostream>
#include <map>
using namespace std;
const int N = 201;
int a[N];
int book[N];
int main(){
int n, m;
cin >> n >> m;
for(int i = 0; i < n; i ++){
cin >> a[i];
book[a[i]] ++;
}
for(int i = 0; i < n; i ++){
if(book[a[i]] - 1 == 0)
cout << "BeiJu" << endl;
else
cout << book[a[i]] - 1 << endl;
}
return 0;
}

查看7道真题和解析