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 niuniu2006 at 2007-06-07 13:10:15 on Problem 2291
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int arr[10000];
	int m;int n;
	cin>>m;
	for(int j=0;j<=m-1;++j)
	{double sum=0;
		cin>>n;
		for(int i=0;i<=n-1;++i)
		{
			cin>>arr[i];
		}
		sort(arr,arr+n);
		for(i=0;i<=n-1;++i)
		{
			double tem;
			tem=arr[i]*(n-i);
			if(tem>sum)
				sum=tem;
		}
		cout<<sum<<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