Files
python/TangDou/LanQiaoBei/LanQiao14GuoSai/2_1.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

22 lines
475 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}