题解 | #谁是你的潜在朋友#
谁是你的潜在朋友
https://www.nowcoder.com/practice/0177394fb25b42b48657bc2b1c6f9fcc
#include <bits/stdc++.h> #include <cstring> using namespace std; int main() { int n, m; while (cin >> n >> m) { int a[m + 1]; memset(a, 0, sizeof(a)); int temp[n]; for (int i = 0 ; i < n ; i++) { int number; cin >> number; temp[i] = number; a[number] ++; } for (int i = 0 ; i < n ; i++) { if (a[temp[i]] > 1) cout << a[temp[i]] - 1 << endl; else cout << "BeiJu" << endl; } } }