Rasheda And The Zeriba Gym - 100283A 计算几何
http://codeforces.com/gym/100283/problem/A
考虑到多边形是不稳定的,是可以变来变去的。
那么总是可以把每个点放到圆上。
所以只需要判断圆心角是不是小于等于360即可。
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <assert.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL; #include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <bitset>
const int maxn = + ;
int a[maxn];
const double eps = 1e-;
int n;
double pi = acos(-1.0);
bool check(double r) {
double res = ;
for (int i = ; i <= n; ++i) {
res += asin(a[i] / 2.0 / r);
}
return res <= pi;
}
void work() {
int sum = ;
int mx = ;
scanf("%d", &n);
for (int i = ; i <= n; ++i) {
cin >> a[i];
mx = max(a[i], mx);
sum += a[i];
}
static int f = ;
printf("Case %d: ", ++f);
if (sum - mx <= mx) {
cout << "can't form a convex polygon" << endl;
return;
}
double be = , en = 3e6 + ;
while (be + eps < en) {
double mid = (be + en) / ;
if (check(mid)) {
en = mid;
} else be = mid;
}
printf("%.4f\n", en);
} int main() {
#ifdef local
freopen("data.txt", "r", stdin);
// freopen("data.txt", "w", stdout);
#endif
freopen("zeriba.in", "r", stdin);
int t;
scanf("%d", &t);
while (t--) work();
return ;
}
Rasheda And The Zeriba Gym - 100283A 计算几何的更多相关文章
- Gym 101055A 计算几何,暴力
http://codeforces.com/gym/101055/problem/A 题目:给定一些三维空间的点,要你找一个平面,能覆盖尽量多的点,只要求输出点数即可.n<=50 因为数据量小, ...
- Gym - 101845D 计算几何
Ignacio is a famous mathematician, some time ago he was married with Dolly, a famous scientific, at ...
- Gym 101464C - 计算几何+二分(uva1463)
不是很难,但是我觉得对代码能力的要求还是挺高的. 注意模块化. 因为是浮点数,所以二分用的很多很多. 参考 https://blog.csdn.net/njupt_lyy/article/detail ...
- Gym 100952J&&2015 HIAST Collegiate Programming Contest J. Polygons Intersection【计算几何求解两个凸多边形的相交面积板子题】
J. Polygons Intersection time limit per test:2 seconds memory limit per test:64 megabytes input:stan ...
- Gym 101606L - Lounge Lizards - [计算几何+LIS]
题目链接:https://codeforces.com/gym/101606/problem/L 题解: 在同一条线上的所有蜥蜴,他们的斜率都是相通的,换句话说可以直接通过斜率将蜥蜴分组. 每一组即代 ...
- 【计算几何】【二分图判定】Gym - 101485C - Cleaning Pipes
题意:有n个水井,每个水井发出一些管线(都是线段),然后每条管线上最多只有一个水井.所有从不同的水井发出的管线的相交点都是清洁点(不存在清洁点是大于两条管线点的交点).你需要在某些管线上放出一些机器人 ...
- 【计算几何】【分类讨论】Gym - 101173C - Convex Contour
注意等边三角形的上顶点是卡不到边界上的. 于是整个凸包分成三部分:左边的连续的三角形.中间的.右边的连续的三角形. 套个计算几何板子求个三角形顶点到圆的切线.三角形顶点到正方形左上角距离啥的就行了,分 ...
- Gym 101917 E 简单计算几何,I 最大流
题目链接 https://codeforces.com/gym/101917 E 题意:给定一个多边形(n个点),然后逆时针旋转A度,然后对多边形进行规约,每个点的x规约到[0,w]范围内,y规约到[ ...
- Gym - 100625G Getting Through 计算几何+并查集
http://codeforces.com/gym/100625/attachments/download/3213/2013-benelux-algorithm-programming-contes ...
随机推荐
- CMD help
ASSOC 显示或修改文件扩展名关联. ATTRIB 显示或更改文件属性. BREAK 设置或清除扩展式 CTRL+C 检查. BCDEDIT 设置启动数据库中的属性以控制启动加载. CACLS 显示 ...
- dancing link 精确覆盖 重复覆盖 (DLX)
申明:因为转载的没有给出转载链接,我就把他的链接附上,请尊重原创: http://www.cnblogs.com/-sunshine/p/3358922.html 如果谁知道原创链接 给一下,请尊重原 ...
- 细谈HTML解析模块
细谈HTML解析模块 Html在网页中所占的位置,用一个简单直观的图给展示一下:
- Unable to resolve target 'android-16'
Just now when I imported the "android-support-v7-appcompat" to ADT,the console pointed out ...
- [ZJOI 2010] 排列计数
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2111 [算法] 一种比较好的理解方式是将该序列看成是一棵堆式存储的二叉树 那么问题转 ...
- HDU5919 Sequence2
传送门 这道题是主席树好题啊-- 题目大意:给定一个序列,每次给定一段区间,区间内所有不同的数第一次出现的位置排成一个序列,求这个序列的中位数. 其实求中位数并不是很难,只要我们能把这个序列中不同的数 ...
- docker容器firewalld端口转发规则
docker容器firewalld端口转发规则 1.配置firewalld端口转发,要先打开端口转发,则需要先 #firewall-cmd --zone=public --add-maspuerade ...
- 解决warning: LF will be replaced by CRLF in **(filename)
使用Windows的Git使用 git add 时出现warning: LF will be replaced by CRLF in **(filename) 原因: CRLF -- Carriage ...
- git add . 的时候遇到warning: LF will be replaced by CRLF inXXX 解决办法
$ git add . warning: LF will be replaced by CRLF in shop/Runtime/Cache/86bbc820c9ec1 d314a9c71cf5651 ...
- Android开发--Activity
一:Activity生命周期 (1)Activity生命周期中的几种方法: protected void onCreate(Bundle savedInstanceState): protected ...