| ||||||||||
| 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 | |||||||||
为什么会OUTPUT LIMIT ERROR??? 就只输出一个数字呀!!!!#include<stdio.h>
#include<string.h>
#define MAX 100050
int num[MAX],temp[MAX];
int give(int b,int e)
{
int i,j;
for(i=b-1,j=0;i<e;i++,j++)
temp[j]=num[i];
return e-b+1;
}
int compare( const void *arg1, const void *arg2 );
void main()
{
int length,test;
while(scanf("%d %d",&length,&test))
{
int begin,end,th,z,i;
for(i=0;i<length;i++)
scanf("%d",&num[i]);
for(i=0;i<test;i++)
{
scanf("%d %d %d",&begin,&end,&th);
z=give(begin,end);
qsort(temp,z,sizeof(int),compare);
printf("%d\n",temp[th-1]);
}
}
}
int compare( const void *arg1, const void *arg2 )
{
return ((char *)arg1)[0]-((char*)arg2)[0];
}
我要疯了!!!!!输出一个数字也会OUTPUT LIMIT ERROR!!!怎么搞的???
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator