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  计算几何的更多相关文章

  1. Gym 101055A 计算几何,暴力

    http://codeforces.com/gym/101055/problem/A 题目:给定一些三维空间的点,要你找一个平面,能覆盖尽量多的点,只要求输出点数即可.n<=50 因为数据量小, ...

  2. Gym - 101845D 计算几何

    Ignacio is a famous mathematician, some time ago he was married with Dolly, a famous scientific, at ...

  3. Gym 101464C - 计算几何+二分(uva1463)

    不是很难,但是我觉得对代码能力的要求还是挺高的. 注意模块化. 因为是浮点数,所以二分用的很多很多. 参考 https://blog.csdn.net/njupt_lyy/article/detail ...

  4. 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 ...

  5. Gym 101606L - Lounge Lizards - [计算几何+LIS]

    题目链接:https://codeforces.com/gym/101606/problem/L 题解: 在同一条线上的所有蜥蜴,他们的斜率都是相通的,换句话说可以直接通过斜率将蜥蜴分组. 每一组即代 ...

  6. 【计算几何】【二分图判定】Gym - 101485C - Cleaning Pipes

    题意:有n个水井,每个水井发出一些管线(都是线段),然后每条管线上最多只有一个水井.所有从不同的水井发出的管线的相交点都是清洁点(不存在清洁点是大于两条管线点的交点).你需要在某些管线上放出一些机器人 ...

  7. 【计算几何】【分类讨论】Gym - 101173C - Convex Contour

    注意等边三角形的上顶点是卡不到边界上的. 于是整个凸包分成三部分:左边的连续的三角形.中间的.右边的连续的三角形. 套个计算几何板子求个三角形顶点到圆的切线.三角形顶点到正方形左上角距离啥的就行了,分 ...

  8. Gym 101917 E 简单计算几何,I 最大流

    题目链接 https://codeforces.com/gym/101917 E 题意:给定一个多边形(n个点),然后逆时针旋转A度,然后对多边形进行规约,每个点的x规约到[0,w]范围内,y规约到[ ...

  9. Gym - 100625G Getting Through 计算几何+并查集

    http://codeforces.com/gym/100625/attachments/download/3213/2013-benelux-algorithm-programming-contes ...

随机推荐

  1. shell动态变量

    面对变量中嵌套变量,可以这么做 other_devops_ip="......." options='_ip' tennat_name='other_devops' tennat_ ...

  2. ansible-playbook 打通ssh无秘钥

    建议参考: http://www.cnblogs.com/jackchen001/p/6514018.html 这个代码清晰,效果佳! 参考链接: http://www.cnblogs.com/cao ...

  3. 关于S50卡密钥A和密钥B

    关于S50卡密钥A和密钥B 1. Mifare_Std 卡片的密钥属性取决于控制字.控制字的默认值是“FF078069”,此时 A密钥:不可被读出,有全部权限. B密钥:可被读出,没有任何权限. 2. ...

  4. [原创]Java开发在线打开编辑保存Word文件(支持多浏览器)

    Java调用PageOffice实现在线编辑保存Word文件(以jsp调用为例,支持SSM.SSH.SpringMVC等流行框架) 1. 下载PageOffice开发包:http://www.zhuo ...

  5. Linux-用户和权限

    1 Linux所有内容都是文件 归一的思想 面向对象的思想 文件只需要做增删改查的操作 2 延迟读取 一般的文本读取工具都是先将内容全部都读入内存中 cat的机制不同 是读一行显示一行 这与它的功能有 ...

  6. Struts文件上传下载

    Struts配置文件: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PU ...

  7. HTML学习笔记(二)HTML格式化

    很多标签都可以用来改变文本的外观,并为文本关联其隐藏的含义.总地来说,这些标签可以分成两类:基于内容的样式(content-based style)和物理样式(physical style). 一.基 ...

  8. windows ping得通,连接不上网

    这是被电脑安装的软件拦截的现象,我们只需要使用.   netsh winsock reset   重启电脑即可

  9. visualstudio Team Foundation Server 使用教程

    一.前沿 Team Foundation Server 是我们开发者使用最多的源代码管理工具.由于自己服务器搭建拉取工作慢的缘故,我使用了微软的 TFS.使用非常方便.快捷.免费.且不公开私有的项目. ...

  10. webpack内置模块ProvidePlugin

    webpack配置ProvidePlugin后,在使用时将不再需要import和require进行引入,直接使用即可. 使用方法: 在webpack.dev.conf.js和webpack.prod. ...