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

大牛们看看我这错在哪了。。。先谢谢大家了。。。

Posted by luguoqing at 2010-12-12 14:33:01 on Problem 2833
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

bool cmp(int a,int b)
{
	return a > b;
}

int main()
{
	int n1,n2;
	int n;
	while( scanf("%d%d%d",&n1,&n2,&n) )
	{
		if( n1 == 0 && n2 == 0 && n == 0 )
		{
			break;
		}
		else
		{
			int  i;
			int  temp;
			__int64  sum = 0;
			vector<int> point;
			point.clear();
			for( i = 0; i < n; i++ )
			{
				scanf("%d",&temp);
				sum += temp;
				point.push_back(temp);
			}
			sort(point.begin(),point.end(),cmp);
			vector<int>::iterator itr;
			for( itr = point.begin(); itr < point.begin() + n1; itr++ )
			{
				sum -= *itr;
			}
			for( itr = point.end() - n2; itr < point.end(); itr++ )
			{
				sum -= *itr;
			}
			printf("%0.6lf\n",(double)sum/(n-n1-n2));
		}
	}
	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