hdu6354 杭电第五场 Everything Has Changed 计算几何
Everything Has Changed
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 292 Accepted Submission(s): 155
Special Judge
Assume the operating plane as a two-dimensional coordinate system. At first, there is a disc with center coordinates (0,0) and radius R. Then, m mechanical arms will cut and erase everything within its area of influence simultaneously, the i-th area of which is a circle with center coordinates (xi,yi) and radius ri (i=1,2,⋯,m). In order to obtain considerable models, it is guaranteed that every two cutting areas have no intersection and no cutting area contains the whole disc.
Your task is to determine the perimeter of the remaining area of the disc excluding internal perimeter.
Here is an illustration of the sample, in which the red curve is counted but the green curve is not.

The following lines describe all the test cases. For each test case:
The first line contains two integers m and R.
The i-th line of the following m lines contains three integers xi,yi and ri, indicating a cutting area.
1≤T≤1000, 1≤m≤100, −1000≤xi,yi≤1000, 1≤R,ri≤1000 (i=1,2,⋯,m).
Formally, let your answer be a and the jury's answer be b. Your answer is considered correct if |a−b|max(1,|b|)≤10−6.
4 10
6 3 5
10 -4 3
-2 -4 4
0 9 1
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define ls (r<<1)
#define rs (r<<1|1)
#define debug(a) cout << #a << " " << a << endl
using namespace std;
typedef long long ll;
const ll maxn = 1e2+10;
const ll mod = 998244353;
const double pi = acos(-1.0);
const double eps = 1e-8;
int main() {
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll T;
cin >> T;
while( T -- ) {
ll m, R;
cin >> m >> R;
double ans = 2*pi*R;
for( ll i = 0, x, y, r; i < m; i ++ ) {
cin >> x >> y >> r;
double dis = sqrt(x*x+y*y);
if( dis >= r+R ) { //外切外离不考虑
continue;
} else if( dis > fabs(R-r) && dis < R+r ) { //相交
double deg1 = acos((dis*dis+R*R-r*r)/(2.0*dis*R));
double deg2 = acos((dis*dis+r*r-R*R)/(2.0*dis*r));
ans -= deg1*2*R;
ans += deg2*2*r;
} else if( dis == R-r ) { //内切
ans += 2*pi*r;
}
}
printf("%.20lf\n",ans);
}
return 0;
}
hdu6354 杭电第五场 Everything Has Changed 计算几何的更多相关文章
- hdu6351 Beautiful Now 杭电第五场 暴力枚举
Beautiful Now Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)T ...
- hdu6373 Pinball 杭电第六场 物理知识
Pinball Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total S ...
- 杭电第四场 hdu6336 Problem E. Matrix from Arrays 打表找规律 矩阵前缀和(模板)
Problem E. Matrix from Arrays Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 ...
- 杭电第六场 hdu6362 oval-and-rectangle 积分求期望
oval-and-rectangle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- 喝奶茶最大值(不能喝自己班级的)2019 Multi-University Training Contest 8--hdu杭电第8场(Roundgod and Milk Tea)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6667 题意: 有 n个班级,每个班级有a个人.b个奶茶,每个班的人不能喝自己的奶茶,只能喝别人班的奶茶 ...
- hdu 1290_献给杭电五十周年校庆的礼物
Description 或许你曾经牢骚满腹或许你依然心怀忧伤或许你近在咫尺或许你我天各一方 对于每一个学子母校 永远航行在生命的海洋 今年是我们杭电建校五十周年,这是一个值得祝福的日子.我们该送给母校 ...
- HDU 1290 献给杭电五十周年校庆的礼物(面分割空间 求得到的最大空间数目)
传送门: 献给杭电五十周年校庆的礼物 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- [HDU1290]献给杭电五十周年校庆的礼物
[HDU1290]献给杭电五十周年校庆的礼物 题目大意: 问\(n(n\le1000)\)个平面能够将一个三维空间分成几部分. 思路: 公式\(\frac{n^3+5n+6}6\). 源代码: #in ...
- 可持久化线段树的学习(区间第k大和查询历史版本的数据)(杭电多校赛第二场1011)
以前我们学习了线段树可以知道,线段树的每一个节点都储存的是一段区间,所以线段树可以做简单的区间查询,更改等简单的操作. 而后面再做有些题目,就可能会碰到一种回退的操作.这里的回退是指回到未做各种操作之 ...
随机推荐
- Codeforces Round #192 (Div. 2) (329A)C.Purification
题意: 在一个正常的点可以净化该行该列的所有细胞,判断是否可以净化所有的细胞,并且输出所选的点. 思路: 如果可以的话,一定会选n个点. 先判断每一行是否有正常细胞,然后判断每一列是否有,如果都没有肯 ...
- RGB颜色 三者都是0为黑色而255是白色 解释
问题: RGB颜色 都是0为黑色而255是白色 与日常生活的黑色白色差距怎么那么大,(与物理学中的黑色吸收光是否相悖)而且为什么要这样定义呢? 链接:https://www.zhihu.com/que ...
- 浅析java中的语法糖
概述 编译器是一种计算机程序, 它主要的目的是将便于人编写.阅读.维护的高级计算机语言所写的源代码程序, 翻译为计算机能解读.运行的低阶机器语言的程序, 即可执行文件.而 javac 就是java语言 ...
- Selenium+java - 调用JavaScript操作
前言 在做web自动化时,有些情况selenium的api无法完成,需要通过第三方手段比如js来完成实现,比如去改变某些元素对象的属性或者进行一些特殊的操作,本文将来讲解怎样来调用JavaScript ...
- S2:类的构造函数
类的构造函数构造函数名与类名形同,不返回任何值,主要完成对象的初始化工作. (1)在构造函数中,可以给属性设置默认值(2)this只带当前对象 (3)如果不给属性赋初始值,则会以默认值来填充.(4)如 ...
- koa2基于stream(流)进行文件上传和下载
阅读目录 一:上传文件(包括单个文件或多个文件上传) 二:下载文件 回到顶部 一:上传文件(包括单个文件或多个文件上传) 在之前一篇文章,我们了解到nodejs中的流的概念,也了解到了使用流的优点,具 ...
- Asp.Net Core WebAPI+PostgreSQL部署在Docker中
PostgreSQL是一个功能强大的开源数据库系统.它支持了大多数的SQL:2008标准的数据类型,包括整型.数值值.布尔型.字节型.字符型.日期型.时间间隔型和时间型,它也支持存储二进制的大对像, ...
- 我的C语言学习1
学习是快乐的,尤其是从之前看到一个程序的一头雾水到大致懂了是怎么回事,这个过程是兴奋开心的,让我不断的前进,不能自拔,今天就要结束,总结一下. 1.1-第一个C语言 #include<stdio ...
- leetcode bug free
---不包含jiuzhang ladders中出现过的题.如出现多个方法,则最后一个方法是最优解. 目录: 1 String 2 Two pointers 3 Array 4 DFS &&am ...
- 【干货】基于镜像部署的Gitlab-CI/CD实践和坑位指南
引言 看过前文的博友可能注意到我是把 部署dll文件拷贝到生产机器,之后在生产机器上使用docker-compose即时创建镜像, 并没有完成CI/CD, 只是在原来传统部署方式下 将部署文件容器化. ...