排序一下。
#include<iostream> #include<cstdio> #include<algorithm> #define maxn 10050 using namespace std; int n,a[maxn]; int main() { scanf("%d",&n); for (int i=1;i<=n;i++) scanf("%d",&a[i]); sort(a+1,a+n+1); printf("%d\n",a[(n+1)>>1]); return 0; }
BZOJ 1753 Who's in the Middle
时间: 2024-10-09 23:28:12