Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
126841 | 左维哲 | 19众数 | C++ | Accepted | 5 MS | 372 KB | 343 | 2025-07-22 12:53:52 |
#include<bits/stdc++.h> using namespace std; int main() { int n, max = 1; cin >> n; int a[n], b[1001]; for(int i=0;i<=1000;i++){ b[i]=0; } for (int i = 0; i < n; i++) { cin >> a[i]; int x=a[i]; b[x]++; } for (int i = 1; i <= 1000; i++) { if (b[max] < b[i]) { max = i; } } cout << max; return 0; }