/*

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. java技术-重点方向

    多线程 锁 事务 缓存 hashmap 并发编程

  2. Sklearn数据集与机器学习

    sklearn数据集与机器学习组成 机器学习组成:模型.策略.优化 <统计机器学习>中指出:机器学习=模型+策略+算法.其实机器学习可以表示为:Learning= Representati ...

  3. sqoop2的安装配置

    1.下载 wget http://mirror.bit.edu.cn/apache/sqoop/1.99.7/sqoop-1.99.7-bin-hadoop200.tar.gz 2.解压 tar -z ...

  4. leetcode35

    public class Solution { public int SearchInsert(int[] nums, int target) { ; i < nums.Length; i++) ...

  5. curl 请求https内容,返回空

    $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$api); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);/ ...

  6. 本地Facts

    我们可以通过Facts来获取目标主机的系统信息,当这些信息还不能满足我们的功能需要时,可以通过编写自定义的Facts模块来实现.当然,还有一个更简单的实现方法,就是通过本地Facts来实现.只需在目标 ...

  7. 2017.1.9版给信息源新增:max_len、max_db字段

    2017.1.8a版程序给信息源增加max_len.max_db字段,分别用于控制:获取条数.数据库保留条数. max_len的说明见此图: max_db的说明见此图: 当max_len和max_db ...

  8. MySQL高级-索引

    1.索引是什么 索引(Index)是帮助MySQL高效获取数据的数据结构.可以得到索引的本质:索引是数据结构. 可以理解为“排好序的快速查找数据结构” 在数据之外,数据库系统还维护着满足特定查找算法的 ...

  9. Managing Images on smartos

    SmartOS依赖images.images是包含在创建新zone或虚拟机时使用的磁盘或文件系统映像和元数据的模板. images使用imgadm工具进行管理. 使用此工具,您可以: 查看和下载在公共 ...

  10. 调试PHP如何让浏览器提示错误

    php.ini中的display_errors的值改为On:或者php代码页顶部加上ini_set("display_errors", "On"); error ...