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> #include<iostream.h> #include<stdlib.h> int main() { int n,i,*p; int com(const void*,const void *); scanf("%d",&n); p=new int[n]; for(i=0;i<n;i++) scanf("%d",&p[i]); qsort((void*)p,n,sizeof(p[0]),com); printf("%d\n",p[n/2]); delete []p; return 0; } int com( const void*a,const void *b) { return *(int*)a>=*(int*)b; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator