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 |
why WA?麻烦大家帮忙看看。怎么不是TLE是WA啊#include "stdio.h" #include "algorithm" int sort_function(const void *a,const void *b) { return(strcmp((char*)a,(char*)b)); } int main() { int n,m,i,j,k,a[100001],t,b[100001]; scanf("%d %d",&n,&m); for(t=0;t<n;t++) scanf("%d",&a[t]); while(m--) { scanf("%d %d %d",&i,&j,&k); for(t=0;t<j-i+1;t++) b[t]=a[t+i-1]; qsort(b,j-i+1,sizeof(int),sort_function); printf("%d\n",b[k-1]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator