| ||||||||||
| 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 | |||||||||
冒泡TLE,qsort 219MS,测试数据看来够大···(附代码)#include <iostream>
using namespace std;
int base[100005];
char str[5];
int n,k;
int compare(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int main()
{
// freopen("in.txt","r",stdin);
int i;
cin>>n;
for(i=0;i<n;i++)
cin>>base[i];
qsort(base,n,sizeof(int),compare);
cin>>str;
cin>>k;
int test;
while(k--)
{
cin>>test;
cout<<base[test-1]<<endl;
}
return 0;
}
除了1000,估计这是我写的最短的一次··
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator