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 |
用库函数快排,为何RuntimeError#include<stdio.h> #include<stdlib.h> #include<string.h> int cmp ( const void *a , const void *b ) { return *(int *)a - *(int *)b; } main() { int n; scanf("%d",&n); int i; int num[10000]; for(i=0;i<n;i++) { scanf("%d",&num[i]); } qsort(num,n,sizeof(num[0]),cmp); char s[3]; scanf("%s",s); int k; scanf("%d",&k); int a; while(k--) { scanf("%d",&a); printf("%d\n",num[a-1]); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator