| ||||||||||
| 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 | |||||||||
一直WA,求解惑#include<stdio.h>
#include<stdlib.h>
int c(const void *a,const void *b)
{
return *((int *)a)-*((int *)b);
}
double s[300000];
int main()
{
int i,n;
double m;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%lf",s+i);
qsort(s,n,sizeof(double),c);
if(n%2==1) printf("%.1lf\n",s[n/2]);
else
{
m=s[n/2]/2.0+s[n/2-1]/2.0;
printf("%.1lf\n",m);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator