簡(jiǎn)單的快排,傻傻的用了自己寫的模版,呵呵
#include "stdio.h"

int num[100005];

void swap(int a,int b)


{
int t;
t=num[a];
num[a]=num[b];
num[b]=t;

}

int partion(int low,int high,int p)


{
while(low<=high)

{
if(low<p)

{

if(num[low]>num[p])
{swap(low,p);p=low;}
low++;
}
else

{
if(high>p)

{

if(num[high]<num[p])
{swap(high,p);p=high;}
}
high--;
}
}
return p;
}

void qsort(int left,int right)


{
int middle;
if(left<right)

{
middle=(left+right)/2;
middle=partion(left,right,middle);
qsort(left,middle-1);
qsort(middle+1,right);
}
}

int main()


{
int n,k,i,q;
char temp[5];
while(scanf("%d",&n)!=EOF)

{
for(i=0;i<n;i++)

{
scanf("%d",&num[i]);
}

scanf("%s",temp);

qsort(0,n-1);

scanf("%d",&k);

for(i=0;i<k;i++)

{
scanf("%d",&q);

printf("%d\n",num[q-1]);
}
}
return 0;
}
