62,620
社区成员
发帖
与我相关
我的任务
分享 public void run() {
Scanner fin = new Scanner(System.in);
int N = fin.nextInt();
int[] count = new int[10001];
for (int i = 0; i < N; ++i) {
/* ++count[fin.nextInt()]; */
count[i]=fin.nextInt();
}
int maxCount = -1;
int result = 0;
for (int i = 1; i <= 10000; ++i) {
if (count[i] > maxCount) {
maxCount = count[i];
result = i;
}
}
System.out.println(result);
} for(int i=0;i<n;i++){
if(arr[i]>MaxCount){
MaxCount=arr[i];
System.out.println("++++"+i+"++"+arr[i]+"++"+MaxCount+"++++");
result=i;
}else{
System.out.println("---"+i+"--"+arr[i]+"--"+MaxCount+"--");
}
}
++++0++0++0++++
++++1++4++4++++
---2--4--4--
---3--1--4--
---4--0--4--
---5--0--4--
---6--0--4--
---7--0--4--
---8--0--4--
这段代码怎么输出是这个样子 arr[4]为什么是0;