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 wrong answer?#include<iostream.h> #include<stdlib.h> int compare(const void *arg1,const void *arg2); void main() { long N,i; cin>>N; int *d=new int[N]; for(i=0;i<N;i++) cin>>d[i]; qsort(d,N,sizeof(int),compare); char c[3]; cin>>c; int K,q; cin>>K; for(i=0;i<K;i++) { cin>>q; cout<<d[q-1]<<endl; } delete [] d; } int compare(const void *arg1,const void *arg2) { return ((char *)arg1)[0]-((char*)arg2)[0]; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator