Stripies
/*
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
Output
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的更多相关文章
- URAL 1161 Stripies(数学+贪心)
Our chemical biologists have invented a new very useful form of life called stripies (in fact, they ...
- Stripies(POJ 1862 贪心)
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 14151 Accepted: 6628 Descrip ...
- POJ 1862 & ZOJ 1543 Stripies(贪心 | 优先队列)
题目链接: PKU:http://poj.org/problem?id=1862 ZJU:http://acm.zju.edu.cn/onlinejudge/showProblem.do?proble ...
- (贪心和优先队列) POJ1862 Stripies
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 21506 Accepted: 9478 Descrip ...
- POJ1862 Stripies 贪心 B
POJ 1862 Stripies https://vjudge.net/problem/POJ-1862 题目: Our chemical biologists have invented ...
- POJ 1862 Stripies (哈夫曼树)
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 10263 Accepted: 4971 Descrip ...
- 【POJ】1862:Stripies【贪心】【优先队列】
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 20456 Accepted: 9098 Descrip ...
- POJ 1862 Stripies【哈夫曼/贪心/优先队列】
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 18198 Accepted: 8175 Descrip ...
- 【POJ - 1862】Stripies (贪心)
Stripies 直接上中文了 Descriptions 我们的化学生物学家发明了一种新的叫stripies非常神奇的生命.该stripies是透明的无定形变形虫似的生物,生活在果冻状的营养培养基平板 ...
随机推荐
- Python Twisted系列教程1:Twisted理论基础
作者:dave@http://krondo.com/in-which-we-begin-at-the-beginning/ 译者:杨晓伟(采用意译) 前言: 最近有人在Twisted邮件列表中提出诸 ...
- selector 模块
selector 模块进行自动匹配,当是windows系统时,自动匹配select, linux系统时,自动匹配epoll,传输时会明确告诉内核响应服务器的地址,速度要更快 import select ...
- 前端开发-5-HTML-总结
1.总体 资源:https://www.processon.com/view/link/5ad1c2d0e4b0b74a6dd64f3c html head标签 title 显示网站的标题 meta ...
- 15 MySQL--索引
索引: http://www.cnblogs.com/linhaifeng/articles/7356064.html http://www.cnblogs.com/linhaifeng/articl ...
- 【Web缓存机制系列】2 – Web浏览器的缓存机制
Web缓存的工作原理 所有的缓存都是基于一套规则来帮助他们决定什么时候使用缓存中的副本提供服务(假设有副本可用的情况下,未被销毁回收或者未被删除修改).这些规则有的在协议中有定义(如HTTP协议1.0 ...
- 使用JS获取当前地理位置方法汇总
使用JS获取当前地理位置方法汇总 投稿:hebedich 字体:[增加 减小] 类型:转载 时间:2014-12-18我要评论 这篇文章主要介绍了使用JS获取当前地理位置方法汇总,需要的朋友可以参考下 ...
- python post json applidation/json
如果使用headers = {"Content-Type": "application/json"},在后台使用request.POST.get()无法获取数据 ...
- 【转】Java自学之路——by马士兵
作者:马士兵老师 JAVA自学之路 一:学会选择 为了就业,不少同学参加各种各样的培训. 决心做软件的,大多数人选的是java,或是.net,也有一些选择了手机.嵌入式.游戏.3G.测试等. 那么究竟 ...
- TEXT 8 Ready, fire, aim
TEXT 8 Ready, fire, aim 预备!开火!瞄准!! Feb 16th 2006 From The Economist print edition Foreword:A vice-pr ...
- 在hadoop运行tensor flow
http://www.infoq.com/cn/articles/deeplearning-tensorflow-casestudy http://www.tuicool.com/articles/a ...