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

AC的

Posted by smm595788087 at 2011-03-26 19:30:30 on Problem 1862
#include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
using namespace std;
int main()
{	//fstream cin("aaa.txt");
	int number,n,i;
	double sum,a[102];

	cin>>n;
	for(i=0;i<n;i++)	
		cin>>a[i];
	if(n==1)
		cout<<fixed<<setprecision(3)<<double(a[0])<<endl;
	else{
			sort(a,a+n);
			for(i=n-2;i>=0;i--)
				a[i]=2*sqrt(a[i]*a[i+1]);
			cout<<fixed<<setprecision(3)<<a[0]<<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