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 |
AC的#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator