Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
105051 张永良 19众数 C++ Accepted 7 MS 276 KB 329 2025-01-12 12:51:30

Tests(11/11):


Code:

#include<iostream> #include<cstring> using namespace std; int main() { int n, a[1001], temp, maxindex; while (cin >> n) { memset(a, 0, sizeof(a)); maxindex = 0; while (n--) { cin >> temp; a[temp]++; } for (int i = 1; i <= 1000; i++) { if (a[i] > a[maxindex]) { maxindex = i; } } cout << maxindex << endl; } }