#include
int milk[10001];
int temp[10001];
int cowNum;
void mergesort(int *a,int start,int end);
void mymerge(int *a,int start,int mid,int end);
int mymax(int a,int b)
{
return (a>b?a:b);
}
int main()
{
int i;
scanf("%d",&cowNum);
for(i=0;i {
scanf("%d",&milk[i]);
}
mergesort(milk,0,cowNum-1);
printf("%d\n",milk[(cowNum/2)]);
return 0;
}
void mergesort(int *a,int start,int end)
{
if(end==start)
return;
int mid=(start+end)/2;
mergesort(a,start,mid);
mergesort(a,mid+1,end);
mymerge(a,start,mid,end);
}
void mymerge(int *a,int start,int mid,int end)
{
int i,length,leftpos,rightpos,count;
length=mymax(mid-start+1,end-mid);
for(i=start;i<=end;i++)
{
a[i]=temp[i];
}
}
阅读(1383) | 评论(0) | 转发(0) |