Advertisement
lily09290110

d153:智力测验 zerojude

Jan 30th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int cmp(const void *a,const void *b)
  4. {
  5.     int x=*(int *)a;
  6.     int y=*(int *)b;
  7.     return (x<y?-1:x>y?1:0);
  8. }
  9. int main(n,i)
  10. {
  11.     int arr[40005],t;
  12.    for(scanf("%d",&t);t>0;t--)
  13.    {
  14.        for(scanf("%d",&n),i=0;i<n;i++) scanf("%d",&arr[i]);
  15.         qsort(arr,n,4,cmp);
  16.         n=(n-1)/2;
  17.         printf("%d\n",arr[n]);
  18.    }
  19.    return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement