POJ 1862 Stripies#贪心(水)
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std; int main()
{
int n;
double w[105];
while(~scanf("%d",&n))
{
for(int i=0;i<n;i++)
{
int m;
scanf("%d",&m);
w[i]=m*1.0;
} sort(w,w+n);
for(int i=n-1;i>0;i--)
{
w[i-1]=2*sqrt(w[i]*w[i-1]);
}
printf("%.3lf\n",w[0]);
}
return 0;
}
POJ 1862 Stripies#贪心(水)的更多相关文章
- POJ 1862 Stripies 贪心+优先队列
http://poj.org/problem?id=1862 题目大意: 有一种生物能两两合并,合并之前的重量分别为m1和m2,合并之后变为2*sqrt(m1*m2),现在给定n个这样的生物,求合并成 ...
- POJ 1862 Stripies【哈夫曼/贪心/优先队列】
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 18198 Accepted: 8175 Descrip ...
- 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 ...
- POJ 3627 Bookshelf 贪心 水~
最近学业上堕落成渣了.得开始好好学习了. 还有呀,相家了,好久没回去啦~ 还有和那谁谁谁... 嗯,不能发表悲观言论.说好的. 如果这么点坎坷都过不去的话,那么这情感也太脆弱. ----------- ...
- STL 训练 POJ - 1862 Stripies
Description Our chemical biologists have invented a new very useful form of life called stripies (in ...
- POJ 1862 Stripies
每次合并最大的两个,优先级队列维护一下. 输出的时候%.3lf G++会WA,C++能AC,改成%.3f,都能AC. #include<cstdio> #include<cstrin ...
- POJ 1862 Stripies 【优先队列】
题意:科学家发现一种奇怪的东西,他们有重量weight,如果他们碰在一起,总重变成2*sqrt(m1*m2).要求出最终的重量的最小值. 思路:每次选取质量m最大的两个stripy进行碰撞结合,能够得 ...
- POJ1862 Stripies 贪心 B
POJ 1862 Stripies https://vjudge.net/problem/POJ-1862 题目: Our chemical biologists have invented ...
随机推荐
- shell -- yes or no
read -p "Do you want to .... [Y/N]? " yn while true; do case $yn in [Yy]|[Yy][Ee][Ss] ) br ...
- mybatis学习笔记二(接口注解)
直接上代码,全部在代码里讲解. 1.实体类 package com.home.entity; /** * 此类是:user实体类 * @author hpc * @2017年1月10日下午9:36:5 ...
- Jenkins slave image
Add a new shell script configure_slave.sh as following: #!/bin/bash dnf -openjdk git wget openssh-se ...
- tcp异常终止连接
服务端: #include <sys/socket.h> #include <unistd.h> #include <sys/types.h> #include & ...
- mysql给表添加外键并查询
CREATE TABLE `heart` ( `heart_ID` ) NOT NULL AUTO_INCREMENT, `heart_name` ) CHARACTER SET utf8 NOT N ...
- 博客停写,搬家到www.54kaikai.com
博客搬家到自己的网站了www.54kaikai.com欢迎访问.
- 2014年蓝桥杯预选赛 C/C++ 本科A组试题--切面条
//主要是要找到f(n)=2*f(n-1)-1的规律. #include <stdio.h> #include <math.h> int f(int n) { if(n==0) ...
- 如何查看centos系统版本
[root@LAMP1 config]# cat /proc/version Linux version 2.6.32-279.el6.x86_64 (mockbuild@c6b9.bsys.dev. ...
- 自己通过反射写的一个属性copy类
package com.xxx.beancopier; import java.lang.annotation.Documented; import java.lang.annotation.Elem ...
- 从P1到P7——我在淘宝这7年(转)
作者: 赵超 发布时间: 2012-02-25 14:47 阅读: 114607 次 推荐: 153 [收藏] (一) 2011-12-08 [原文链接] 今天有同事恭喜我,我才知道自己在淘 ...