AcWing 3404. 谁是你的潜在朋友
原题链接
简单
作者:
sowei
,
2021-05-19 10:58:04
,
所有人可见
,
阅读 218
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] bookRead = new int[n];
Map<Integer, Integer> map = new HashMap<>();
for(int i = 0; i < n; i++) {
int book = sc.nextInt();
bookRead[i] = book;
map.put(book, map.getOrDefault(book, 0) + 1);
}
for(int i = 0; i < n; i++) {
if(map.get(bookRead[i]) == 1) System.out.println("BeiJu");
else System.out.println(map.get(bookRead[i]) - 1);
}
}
}