Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
146279 唐伟宸 19众数 C++ Accepted 4 MS 276 KB 595 2026-01-27 19:40:30

Tests(11/11):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int a[1001] = {0}; int main() { int x, n, b; int max = -1; cin >> n; for (int i = 1; i <= n; i++) { cin >> x; a[x]++; } for (int i = 1; i <= 1000; i++) { if (a[i] > max) { max = a[i]; b = i; } } cout << b; return 0; }