Run ID:123184

提交时间:2025-06-28 12:43:40

#include<bits/stdc++.h> using namespace std; int main() { int b[1001];//b[0]不用,b[1]~b[1000]用来保存次数 for (int i = 1; i <= 1000; i++) { b[i] = 0; } int n; cin >> n; for (int i = 1; i <= n; i++) { int x; cin >> x; b[x]++; } int c = 1; for (int i = 2; i <= 1000; i++) { if (b[i] > b[c]) { c = i; } } cout << c; return 0; }