简单取中
中位数
http://www.nowcoder.com/questionTerminal/2364ff2463984f09904170cf6f67f69a
#include <stdio.h> int cmp(const void*a,const void *b) //从小到大排序 { return *(int *)a-*(int *)b; } int main(){ int n,i; while(scanf("%d",&n)!=EOF){ if(n==0) break; int a[n]; for(i=0;i<n;i++) scanf("%d",&a[i]); qsort(a,n,sizeof(a[0]),cmp); //快速排序 if (n%2==0) printf("%d\n",(a[n/2]+a[n/2-1])/2); else printf("%d\n",a[n/2]); } }(•̀ᴗ•́)و