/*

Our chemical biologists have invented a new very useful form of life called stripies (in fact, they were first called in Russian - polosatiki, but the scientists had to invent an English name to apply for an international patent). The stripies are transparent amorphous amebiform creatures that live in flat colonies in a jelly-like nutrient medium. Most of the time the stripies are moving. When two of them collide a new stripie appears instead of them. Long observations made by our scientists enabled them to establish that the weight of the new stripie isn't equal to the sum of weights of two disappeared stripies that collided; nevertheless, they soon learned that when two stripies of weights m1 and m2 collide the weight of resulting stripie equals to 2*sqrt(m1*m2). Our chemical biologists are very anxious to know to what limits can decrease the total weight of a given colony of stripies.
You are to write a program that will help them to answer this question. You may assume that 3 or more stipies never collide together.
Input

The first line of the input contains one integer N (1 <= N <= 100) - the number of stripies in a colony. Each of next N lines contains one integer ranging from 1 to 10000 - the weight of the corresponding stripie.

Output

The output must contain one line with the minimal possible total weight of colony with the accuracy of three decimal digits after the point.

Sample Input

3
72
30
50

Sample Output

120.000

*/
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
int main()
{
 int n;
 while(cin >> n)
    {
        priority_queue<double> q;
        while(n--)
        {
            int a;
            cin >> a;
            q.push(a);
        }
        double aim = q.top();
        while(q.size() > )
        {
            double x = q.top();
            q.pop();
            double y = q.top();
            q.pop();
            double ans = * sqrt(x * y);
            q.push(ans);
        }
        aim = q.top();
        //cout << q.top() << endl;
        printf("%.3lf\n",aim);
    }
 return ;
}

Stripies的更多相关文章

  1. URAL 1161 Stripies(数学+贪心)

    Our chemical biologists have invented a new very useful form of life called stripies (in fact, they ...

  2. Stripies(POJ 1862 贪心)

    Stripies Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 14151   Accepted: 6628 Descrip ...

  3. POJ 1862 &amp; ZOJ 1543 Stripies(贪心 | 优先队列)

    题目链接: PKU:http://poj.org/problem?id=1862 ZJU:http://acm.zju.edu.cn/onlinejudge/showProblem.do?proble ...

  4. (贪心和优先队列) POJ1862 Stripies

    Stripies Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 21506   Accepted: 9478 Descrip ...

  5. POJ1862 Stripies 贪心 B

    POJ 1862 Stripies https://vjudge.net/problem/POJ-1862 题目:     Our chemical biologists have invented ...

  6. POJ 1862 Stripies (哈夫曼树)

    Stripies Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10263   Accepted: 4971 Descrip ...

  7. 【POJ】1862:Stripies【贪心】【优先队列】

    Stripies Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 20456   Accepted: 9098 Descrip ...

  8. POJ 1862 Stripies【哈夫曼/贪心/优先队列】

    Stripies Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 18198   Accepted: 8175 Descrip ...

  9. 【POJ - 1862】Stripies (贪心)

    Stripies 直接上中文了 Descriptions 我们的化学生物学家发明了一种新的叫stripies非常神奇的生命.该stripies是透明的无定形变形虫似的生物,生活在果冻状的营养培养基平板 ...

随机推荐

  1. Solr学习之二-Solr基础知识

    一 基本说明 简单来说Solr是基于Lucene的高性能的,开源的Java企业搜索服务器.Solr可以看作一个Web app,运行在tomcat或Jetty这类HTTP服务器上, 底层是一个基于Luc ...

  2. [Python] 拉格朗日插值

    #-*— coding:utf-8 -*- #Program 0.3 Lagrange Interpolation import matplotlib.pyplot as plt import num ...

  3. ckeditor源码编辑模式,添加style、javascript内容丢失的解决

    我使用ckeditor 我在编辑的使用源码编辑,保存内容包含javascript.style标签的时候,数据库中有javascript.style标签 , 输入到页面也可以执行,但是我再次编辑的时候就 ...

  4. 位运算骚操作 Part 2

    ▶ 计算 unsigned int v 的以 2 为底的对数,结果放入 unsigned int r . // 方法零 #pragma unroll ;v; r++, v >>= ); / ...

  5. phpExcel中文帮助手册

    phpExcel中文帮助手册 Admin 2011年11月13日 名人名言:上人生的旅途吧.前途很远,也很暗.然而不要怕.不怕的人的面前才有路.——有岛武郎 下面是总结的几个应用办法 include ...

  6. springboot email 中常量值 配置 mailUtils

    列如:邮件配置: application-test.properties #################Email config start############################ ...

  7. 使用Travis进行持续集成

    使用Travis进行持续集成 廖雪峰 持续集成:Continuous Integration,简称CI,意思是,在一个项目中,任何人对代码库的任何改动,都会触发CI服务器自动对项目进行构建,自动运行测 ...

  8. 创建一个多进程(multiprocessing.Process)

    进程是资源的集合,每个进程至少包含一个线程 import multiprocessing #导入进程模块import time, threading #导入线程 def thread_run(): p ...

  9. Windows窗体技术

    Windows窗体技术 Winform例子下载 https://pan.baidu.com/s/1zXO8gVuFAeKQ_Tnz55A4VQ  密码:i1r6

  10. WP8.1 发送邮件

    Method 1: Windows.System.Launcher.LaunchUriAsync(new Uri("abc@outlook.com?subject=hello world&a ...