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 |
很猥琐地偷懒了,但是很无辜的错了,附错的代码。。。#include<stdio.h>/*Who's in the middle*/ #include<stdlib.h> #define SIZE 10010 int Cmp(const void *a,const void *b) {return *(int *)a-*(int *)b;} int main() { int i,n,a[SIZE]; scanf("%d",&n); for(i=0;i<n;i++)scanf("%d",&a[i]); qsort(a,n,sizeof(int),Cmp); printf("middle=%d\n",a[n/2]); return 0; } 输出的是 middle=%d,居然忘了,WA了两三次。。。。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator