poj 1862

贪心

#include<iostream>
#include<fstream>
#include<cmath>
#include<queue>

using namespace std;


int n;

void read(){
//    ifstream cin("in.txt");
    int i,j,k;
    double s,t;
    cin>>n;
    priority_queue<double> q;
    for(i=1;i<=n;i++)
    {
       
        cin>>j;
        t=j;
        q.push(t);
    }
    while(1)
    {
        s=q.top();
        q.pop();
        if(q.empty())
        {
            printf("%.3lf\n",s);
            return ;
        }
        t=q.top();
        q.pop();
        q.push(2*sqrt(s*t));
    }
}


int main(){
    read();
    return 0;
}

posted on 2011-06-15 15:50  宇宙吾心  阅读(187)  评论(0)    收藏  举报

导航