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 ...
随机推荐
- linux网络配置及IP绑定
在学习时,参考了这篇文章:http://blog.csdn.net/collection4u/article/details/14127671:在这篇文章中作者讲述了VMware中虚机的三种网络模式: ...
- DataSnap Mobile Client Tutorial
One of my customers was having some difficulty following the DataSnap tutorial which can be found he ...
- js运行机制及异步编程(一)
相信大家在面试的过程中经常遇到查看执行顺序的问题,如setTimeout,promise,async await等等,各种组合,是不是感觉头都要晕掉了,其实这些问题最终还是考察大家对js的运行机制是否 ...
- download file by python in google colab
https://stackoverflow.com/questions/15352668/download-and-decompress-gzipped-file-in-memory You need ...
- springboot使用thymeleaf 解析异常
在使用springboot的过程中,如果使用thymeleaf作为模板文件,则要求HTML格式必须为严格的html5格式,必须有结束标签,否则会报错!解决办法如下: 1.你可以使用严格的标签,也就是每 ...
- oracle:rman恢复----通过增量备份来恢复
试验计划:先rman进行一个0级备份,插入表相关数据,再进行level 1级增量备份,进行rman恢复 实验环境:归档模式下,oracle10.2.0.1 开始试验: 1. rman level 0级 ...
- java -- 虚拟机和内存
从大方向来分:栈内存,堆内存,方法区,本地方法栈,程序计数器 java从存储数据的角度来分: 寄存器(register):最快的存储区,由编译器根据需求进行分配,不由认为控制. 堆栈(statck): ...
- SDOI2016 Round1 题解
BZOJ4513 储能表 数位DP,f[i][2][2][2]表示前i位,是否卡n的上界,是否卡m的上界,是否卡k的下界,枚举每一维的下一位直接转移. #include<cstdio> # ...
- 【NOIP2012】 国王游戏
[题目链接] 点击打开链接 [算法] 按ai * bi升序排序,贪心即可 [代码] #include<bits/stdc++.h> using namespace std; #define ...
- 【BZOJ 2818】 GCD
[题目链接] 点击打开链接 [算法] 线性筛出不大于N的所有素数,枚举gcd(x,y)(设为p),问题转化为求(x,y)=p的个数 设x=x'p, y=y'p,那么有(x,y)=1且 ...