-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA37.java
More file actions
34 lines (27 loc) · 793 Bytes
/
Copy pathA37.java
File metadata and controls
34 lines (27 loc) · 793 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
27
28
29
30
31
32
33
34
import java.util.Scanner;
import java.lang.Math;
public class A37 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] A = new int[n];
int max = Integer.MIN_VALUE;
for (int i = 0; i < n; i++) {
A[i] = scan.nextInt();
if (A[i] > max)
max = A[i];
}
int[] count = new int[max + 1];
for (int i = 0; i < n; i++)
count[A[i]]++;
int[] res = new int[2];
for (int i = 0; i < max + 1; i++) {
if (count[i] > 0)
res[1]++;
if (count[i] > res[0])
res[0] = count[i];
}
for (int a : res)
System.out.print(a + " ");
}
}