You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
475 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int a[N];
int b[N]; // 开1e6不够开2e9就会MLE用桶是不行的
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i], b[a[i]]++;
bool flag = false;
for (int i = 1; i <= n; i++)
if (b[a[i]] > n / 2) {
cout << a[i];
flag = true;
break;
}
if (!flag) cout << "No";
return 0;
}