水题~
AC代码:
#include <stdio.h>
#include <algorithm>
using namespace std;
int hhash[10010];
int main(){
int n;
scanf("%d",&n);
for(int i = 1;i <= 10000;i++){
hhash[i] = 0;
}
int num;
for(int i = 0;i <n;i++){
scanf("%d",&num);
hhash[num]++;
}
int max = 0;
int cnt = 0;
for(int i = 1;i <= 10000;i++){
if(hhash[i] >cnt){
cnt = hhash[i];
max = i;
}
else if(hhash[i] == cnt && i <max){
max = i;
}
}
printf("%d",max);
}