Stripies(POJ 1862 贪心)
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 14151 | Accepted: 6628 |
Description
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 <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
int main()
{
int n,i,j;
double w,a,b,sum;
priority_queue<double> s;
freopen("in.txt","r",stdin);
while(scanf("%d",&n)!=EOF)
{
for(i=;i<n;i++)
{
scanf("%lf",&w);
s.push(w);
}
while()
{
a=s.top();
s.pop();
if(s.empty())
break;
b=s.top();
s.pop();
s.push(*sqrt(a*b));
}
printf("%0.3lf\n",a);
}
}
Stripies(POJ 1862 贪心)的更多相关文章
- 【贪心】Stripies POJ 1862
题目描述:http://poj.org/problem?id=1862 题目大意:你有n个数要合并,每两个数x,y合并后得到2*sqrt(x*y).求最后留下的一个数的最小值. 每合并一次,就会有数被 ...
- POJ 1862 & ZOJ 1543 Stripies(贪心 | 优先队列)
题目链接: PKU:http://poj.org/problem?id=1862 ZJU:http://acm.zju.edu.cn/onlinejudge/showProblem.do?proble ...
- POJ 1862 Stripies 贪心+优先队列
http://poj.org/problem?id=1862 题目大意: 有一种生物能两两合并,合并之前的重量分别为m1和m2,合并之后变为2*sqrt(m1*m2),现在给定n个这样的生物,求合并成 ...
- 【POJ - 1862】Stripies (贪心)
Stripies 直接上中文了 Descriptions 我们的化学生物学家发明了一种新的叫stripies非常神奇的生命.该stripies是透明的无定形变形虫似的生物,生活在果冻状的营养培养基平板 ...
- POJ 1862 Stripies【哈夫曼/贪心/优先队列】
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 18198 Accepted: 8175 Descrip ...
- POJ 1862 Stripies#贪心(水)
(- ̄▽ ̄)-* #include<iostream> #include<cstdio> #include<cmath> #include<algorithm ...
- poj 1862 Stripies/优先队列
原题链接:http://poj.org/problem?id=1862 简单题,贪心+优先队列主要练习一下stl大根堆 写了几种实现方式写成类的形式还是要慢一些... 手打的heap: 1: #inc ...
- POJ 1862 Stripies (哈夫曼树)
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 10263 Accepted: 4971 Descrip ...
- STL 训练 POJ - 1862 Stripies
Description Our chemical biologists have invented a new very useful form of life called stripies (in ...
随机推荐
- 答:我们公司的ASP.NET 笔试题,你觉得难度如何
闲来无事,逛逛园子,发现有个面试题,觉得有意思.已自己的理解答来看看,不足之处,请多指教. 原文地址:http://www.cnblogs.com/leotsai/p/aspnet-tests-for ...
- LoadRunner参数化功能详解
更新方式: . Each Occurrence 每次遇到参数就进行更新. 多次使用同一参数,而且没有什么关联,例如随机数. Each Iteration 每次迭代时发生更新. 如果参数出现几 ...
- html 作业1
<body bgcolor="#000000" topmargin="200px" leftmargin="200px" text=& ...
- Spring Boot 启动加载数据 CommandLineRunner
实际应用中,我们会有在项目服务启动的时候就去加载一些数据或做一些事情这样的需求. 为了解决这样的问题,Spring Boot 为我们提供了一个方法,通过实现接口 CommandLineRunner 来 ...
- 【转】(总结)Linux下su与su -命令的本质区别
原文网址:http://www.ha97.com/4001.html 本人以前一直习惯直接使用root,很少使用su,前几天才发现su与su -命令是有着本质区别的! 大部分Linux发行版的默认账户 ...
- Jquery autocomplete 插件示例
通过Jquery autocomplete 插件动态传递输入参数完成自动完成提示: <%@ page language="java" import="java.ut ...
- safari浏览器cookie问题
这个题目可能有点大了,这里主要讨论一种解决safari浏览器阻止第三方cookie问题. 场景 公司存在多个域名(a.com,b.com,co.com)这些域名应该统一 ...
- SharePoint excel service web part 连接到 filter web part
本文讲述SharePoint excel service web part 连接到 filter web part的一个简单应用场景. SharePoint excel service web par ...
- nginx、fastCGI、php-fpm关系梳理(转载参考)
nginx.fastCGI.php-fpm关系梳理 还可以参考:http://www.cnblogs.com/skynet/p/4173450.html 前言: Linux下搭建nginx+php ...
- hdu 4336 Card Collector(期望 dp 状态压缩)
Problem Description In your childhood, people in the famous novel Water Margin, you will win an amaz ...