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

明明只需要sort一下遍历就好了。。。

Posted by xiaowei123456 at 2018-05-16 16:44:04 on Problem 1862
#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:
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