-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ02007.java
More file actions
26 lines (23 loc) · 844 Bytes
/
J02007.java
File metadata and controls
26 lines (23 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.*;
public class J02007 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int x = 1; x <= t; x++) {
int n = sc.nextInt();
LinkedHashMap<Integer, Integer> mp = new LinkedHashMap<>();
for (int i = 0; i < n; i++) {
int tmp = sc.nextInt();
if (mp.containsKey(tmp)) {
mp.put(tmp, mp.get(tmp) + 1);
} else {
mp.put(tmp, 1);
}
}
System.out.println("Test " + x + ":");
for (Map.Entry<Integer, Integer> et : mp.entrySet()) {
System.out.println(et.getKey() + " xuat hien " + et.getValue() + " lan");
}
}
}
}