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

why WA?麻烦大家帮忙看看。怎么不是TLE是WA啊

Posted by raymond8023 at 2007-11-05 22:21:53 on Problem 2104
#include "stdio.h"
#include "algorithm"

int sort_function(const void *a,const void *b)   
{  
        return(strcmp((char*)a,(char*)b));   
}   

int main()
{
	int n,m,i,j,k,a[100001],t,b[100001];
	scanf("%d %d",&n,&m);
	for(t=0;t<n;t++)
		scanf("%d",&a[t]);
	while(m--)
	{
		scanf("%d %d %d",&i,&j,&k);
		for(t=0;t<j-i+1;t++)
			b[t]=a[t+i-1];
		qsort(b,j-i+1,sizeof(int),sort_function);
		printf("%d\n",b[k-1]);
	}
	return 0;
}

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