| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这都能过.....#include<stdio.h>
int a[1000001];
int b[10001];
int main()
{
int i,j,k,n,mid;
while (scanf("%d",&n)!=EOF)
{
for (i=0;i<=1000000;i++)
a[i]=0;
for (i=1;i<=n;i++)
{
scanf("%d",&k);
a[k]++;
}
j=0;
for (i=1;i<=1000000;i++)
while (a[i]>0)
{
j++;
b[j]=i;
a[i]--;
}
if (n%2==1) printf("%d\n",b[(n+1)/2]);
else printf("%d",(b[n/2]+b[n/2+1])/2);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator