| ||||||||||
| 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 | |||||||||
附代码吧!so easy!!!#include <stdio.h>
#include <stdlib.h>
int cmp(const void *_a,const void *_b)
{
int *a=(int*)_a;
int *b=(int*)_b;
return *a-*b;
}
int main()
{
int *a=NULL,n,m;
while(scanf("%d",&n)!=EOF)
{
a=(int*)malloc(sizeof(int)*(n+1));
for(m=1;m<=n;m++)
scanf("%d",&a[m]);
qsort(a+1,n,sizeof(a[0]),cmp);
n=(n+1)/2;
printf("%d\n",a[n]);
}
return 1;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator