不明白哪里错了???orz~~~
import java.util.*;
public class Main {
public static class point {//类似结构体
public int score;
}
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
point stu[] = new point[1001];
int m, i, a, max, k;// 如果k未赋值的话,就显示错误???
long n;
m = input.nextInt();
n = input.nextInt();
for (i = 1; i <= n; i++) {
stu[i] = new point();
a = input.nextInt();
stu[a].score++;
}
max = stu[1].score;
k = 1;
for (i = 2; i <= m; i++) {
if (max < stu[i].score) {
max = stu[i].score;
k = i;
}
}
System.out.print(k+"\n");
System.out.println(max);
}
}