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 ;
}
最新文章
- Spring+Quartz实现定时任务
- textarea 在浏览器中固定大小和禁止拖动
- Win10如何设置防火墙开放特定端口 windows10防火墙设置对特定端口开放的方法
- IOS调试lldb命令常用,po,
- Redis学习笔记(9)-管道/分布式
- TWaver HTML5 (2D)--基本概念
- Jsch
- 使ViewFlipper中的WebView实现手势效果
- 使用padding-top实现自适应背景图片
- 关于Redis的一些常识
- Jquery时间快捷控件(Jtime)配置v1.1
- 查看Android下生成的.db数据库
- Ubuntu上安装VMware tools
- .net排坑篇:负载均衡域名转发的背后
- js获取元素下标
- 【转】 js数组 Array 交集 并集 差集 去重
- 状态管理Vuex
- php 中的 “!=”和“!==”
- [rrdtool]监控和自己主动绘图,简单的监控.md
- 视锥体(frustum)裁剪