题解 | #谁是你的潜在朋友#
谁是你的潜在朋友
https://www.nowcoder.com/practice/0177394fb25b42b48657bc2b1c6f9fcc
#include <iostream> using namespace std; #include "map" int n, m; const int N = 210; int a[N]; int main() { map<int, int> Book; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; Book[a[i]]++; } for(int i=1;i<=n;i++){ if(Book[a[i]] == 1){ cout << "BeiJu"<<endl; }else { cout << Book[a[i]] -1 << endl; } } } // 64 位输出请用 printf("%lld")