结论题。
直接排序输出第 个位置的元素即可。因为众数一定经过这个位置,应该很显然吧。。
CODE:
#include <bits/stdc++.h>
using namespace std;
#define int long long
int a[50010];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a + 1, a + 1 + n);
cout << a[(int)ceil(n / 2.0)];
return 0;
}