#include<stdio.h>
int main()
{
int a[10000];
int n, k = 0;
int t = 0;
int x = 0;
int i,j;
while (scanf("%d", &n)!=EOF)
{
int b[1001] = { 0 };
int max = 0;
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (j = 0; j < n; j++) {
k = a[j];
b[k]++;
}
for (t = 0; t < 1001; t++) {
if (b[t] > max) {
max = b[t];
x = t;
}
}
printf("%d\n", x);
}
return 0;
}
7-5 众数
最新推荐文章于 2024-09-09 12:46:52 发布