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 ...
随机推荐
- Android 5.x SEAndroid/SElinux内核节点的读写权限【学习笔记】
本文转载自:http://blog.csdn.net/tung214/article/details/44461985 Android 5.0下,因为采取了SEAndroid/SElinux的安全机制 ...
- 树状数组(二叉索引树 BIT Fenwick树) *【一维基础模板】(查询区间和+修改更新)
刘汝佳:<训练指南>Page(194) #include <stdio.h> #include <string.h> #include <stdlib.h&g ...
- .Net线程池ThreadPool导致内存高的问题分析
最近写了一个WinFrom程序.此程序侦听TCP端口,接受消息处理,然后再把处理后的消息,利用线程池通过WebService发送出去(即一进一出). 在程序编写完成后,进行压力测试.用Fiddler提 ...
- 计算机学院大学生程序设计竞赛(2015’12)Pick Game
Pick Game Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- codeforces 459 A. Pashmak and Garden 解题报告
题目链接:http://codeforces.com/problemset/problem/459/A 题目意思:给出两个点的坐标你,问能否判断是一个正方形,能则输出剩下两点的坐标,不能就输出 -1. ...
- vmware9虚拟机通过NAT上网方式设置
vmware虚机上网的网络连接方式有bridge.NAT.Host-only等,如果对这个不了解的可以学习这篇文章http://wangchunhai.blog.51cto.com/225186/38 ...
- Android 增,删,改,查 通讯录中的联系人
一.权限 操作通讯录必须在AndroidManifest.xml中先添加2个权限, <uses-permission android:name="android.permission. ...
- UISwitch用法:
代码: #import "ViewController.h" @interface ViewController () @end @implementation ViewContr ...
- Java输入/输出(I/O)流的分类总结
java.io中有四个重要的抽象类: InputStream(字节输入流) Reader(字符输入流) OutputStream(字节输出流) Writer(字符输出流) 其中,InputStream ...
- javascript之递归得DOM文本
var tag=document.getElementsByTagName('body')[0]; function findChild(tag){ var child=tag.childNodes ...