Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么会OUTPUT LIMIT ERROR??? 就只输出一个数字呀!!!!

Posted by up at 2005-08-18 22:55:04 on Problem 2104
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator