poj1862 Stripies
思路:
简单贪心。
实现:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std; int a[], n; bool cmp(const int & a, const int & b)
{
return a > b;
} int main()
{
cin >> n;
for (int i = ; i < n; i++)
{
cin >> a[i];
}
sort(a, a + n, cmp);
double res = a[];
for (int i = ; i < n - ; i++)
{
res = 2.0 * sqrt(res * a[i + ]);
}
printf("%.3f\n", res);
return ;
}
poj1862 Stripies的更多相关文章
- POJ1862 Stripies 贪心 B
POJ 1862 Stripies https://vjudge.net/problem/POJ-1862 题目: Our chemical biologists have invented ...
- (贪心和优先队列) POJ1862 Stripies
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 21506 Accepted: 9478 Descrip ...
- 《挑战程序设计竞赛》2.2 贪心法-其它 POJ3617 3069 3253 2393 1017 3040 1862 3262
POJ3617 Best Cow Line 题意 给定长度为N的字符串S,要构造一个长度为N的字符串T.起初,T是一个空串,随后反复进行下列任意操作: 从S的头部(或尾部)删除一个字符,加到T的尾部 ...
- 【POJ - 1862】Stripies (贪心)
Stripies 直接上中文了 Descriptions 我们的化学生物学家发明了一种新的叫stripies非常神奇的生命.该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 ...
- POJ 1862 Stripies (哈夫曼树)
Stripies Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 10263 Accepted: 4971 Descrip ...
- Stripies
/* Our chemical biologists have invented a new very useful form of life called stripies (in fact, th ...
随机推荐
- POJ1077 Eight —— 正向BFS
主页面:http://www.cnblogs.com/DOLFAMINGO/p/7538588.html 代码一:以数组充当队列,利用结构体中的pre追溯上一个状态在数组(队列)中的下标: #incl ...
- HDU1495 非常可乐 —— BFS + 模拟
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1495 非常可乐 Time Limit: 2000/1000 MS (Java/Others) M ...
- sed替换变量
今天在写脚本时用到了sed,我用sed替换xml文件中的变量.一般在sed 中替换都用单引号,如下边 sed -i ‘s/10/1000/g’ test.xml但是如果需要把1000改成变量,如sed ...
- 计算机学院大学生程序设计竞赛(2015’12)Study Words
Study Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- iOS中NSNotification、delegate、KVO三者之间的区别与联系?
前面分别讲了delegate.notification和KVO的实现原理,以及实际使用步骤,我们心中不禁有个疑问,他们的功能比较类似,那么在实际的编程中,如何选择这些方式呢? 在网上看到一个博客上详细 ...
- servlet中的servletURL,servletURI和servletPath
String servletURL=request.getservletURL(); url:站点名+当前web应用名+(目录名)+页面名 String servletURI=reques ...
- scp.sh
#!/bin/sh #Auto change server files #liudong 2016-3-21 if [ ! -f ip.txt ];then echo -e "\033[31 ...
- Cmake生成Makefile
cmake 相比automake 最大的区别是: 步骤没有automake那么多 main.cpp #include<iostream> #include"student.h&q ...
- Eclipse中删除导入的jar包,总是报错?已解决!
参考百度经验 http://jingyan.baidu.com/article/851fbc37c7512e3e1f15abec.html
- E20180413-hm
skew adj. 斜的,歪的; [数学] 不对称的; [统计学] 歪斜,扭曲; vt. 歪曲; 曲解; 使歪斜; vi. 偏离,歪斜; 斜视; traversal n. 横越,横断物,(横 ...