| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
明明只需要sort一下遍历就好了。。。#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Max_n=110;
int n;
double a[Max_n];
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%lf",&a[i]);
sort(a,a+n);
double s=a[n-1];
for(int i=n-2;i>=0;i--){
s=2*sqrt(s*a[i]);
}
printf("%.3f\n",s);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator