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

run time erro?

Posted by 19900217 at 2009-05-25 18:39:58 on Problem 3325
#include<iostream>
using namespace std;
int main()
{
	int n,a[20],i;
	while(cin>>n)
	{
		if(n==0)
	       break;	
		int mn=1001,x=-1,sum=0,aver;
		for(i=0;i<n;i++)
		{
			cin>>a[i];
            sum=sum+a[i];
			if(a[i]<mn)
				mn=a[i];
			if(a[i]>x)
				x=a[i];
		}
		aver=(sum-x-mn)/(n-2);
		cout<<aver<<endl;
	}
	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