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 |
水题来的,一次AC#include<iostream> #include<cstdlib> using namespace std; int cmp(const void *a, const void *b) { return *(int *)a-*(int *)b; } int main() { int n,k,i,j; char s[5]; int *p; cin>>n; p=new int[n]; for(i=0;i<n;i++) cin>>p[i]; qsort(p,n,sizeof(int) ,cmp); cin>>s;cin>>k; int *q=new int[k]; for(i=0;i<k;i++) cin>>q[i]; j=0; while(j<k) { cout<<p[q[j]-1]<<endl; j++; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator