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

一直Running Error,有人帮忙看看吗?

Posted by Nedvid at 2008-04-13 22:28:11 on Problem 2833
#include<stdio.h>
#include<stdlib.h>
int cmp ( const void *a , const void *b )
{
return *(long *)a - *(long *)b;
}
void main()
{
	long max,min,n,i,j;__int64 sum;
	long a[50001];
	while(scanf("%ld%ld%ld",&max,&min,&n))
	{
		sum=0L;
		if(max==0&&min==0&&n==0)break;
		else 
		{
			for(i=0;i<n;i++)
				scanf("%ld",&a[i]);
			//quicksort(a,0,n-1);
			qsort(a,n,sizeof(a[0]),cmp); 
			for(j=min;j<n-max;j++)
				sum+=a[j];
			printf("%.6lf\n",(double)(sum)/(double)(n-min-max));
		}
	}
}

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