Run ID:126842

提交时间:2025-07-22 12:56:27

#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; //初始化数组b int b[1001]; for (int i = 1; i <= 1000; i++) { b[i] = 0; } for (int i = 0; i < n; i++) { int x; cin >> x; b[x]++; } //接下来求数组b最大值的下标 int max = 1; //为什么不写0? for (int i = 2; i <= 1000; i++) { if (b[i] > b[max]) { max = i; } } cout << max; return 0; }