E - Everything Has Changed HDU - 6354
Assume the operating plane as a two-dimensional coordinate system. At first, there is a disc with center coordinates (0,0)(0,0) and radius RR. Then, mm mechanical arms will cut and erase everything within its area of influence simultaneously, the ii-th area of which is a circle with center coordinates (xi,yi)(xi,yi) and radius riri (i=1,2,⋯,m)(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.
Input
The first line contains one integer TT, indicating the number of test cases.
The following lines describe all the test cases. For each test case:
The first line contains two integers mm and RR.
The ii-th line of the following mm lines contains three integers xi,yixi,yi and riri, indicating a cutting area.
1≤T≤10001≤T≤1000, 1≤m≤1001≤m≤100, −1000≤xi,yi≤1000−1000≤xi,yi≤1000, 1≤R,ri≤10001≤R,ri≤1000 (i=1,2,⋯,m)(i=1,2,⋯,m).
Output
For each test case, print the perimeter of the remaining area in one line. Your answer is considered correct if its absolute or relative error does not exceed 10−610−6.
Formally, let your answer be aa and the jury's answer be bb. Your answer is considered correct if |a−b|max(1,|b|)≤10−6|a−b|max(1,|b|)≤10−6.
Sample Input
1
4 10
6 3 5
10 -4 3
-2 -4 4
0 9 1
Sample Output
81.62198908430238475376
1 #include <iostream>
2 #include <stdio.h>
3 #include <algorithm>
4 #include <cmath>
5 #include <math.h>
6 #include <cstring>
7 #include <string>
8 #include <queue>
9 #include <deque>
10 #include <stack>
11 #include <stdlib.h>
12 #include <list>
13 #include <map>
14 #include <utility>
15 #include <time.h>
16 #include <set>
17 #include <bitset>
18 #include <vector>
19 #define ms(a,b) memset(a,b,sizeof(a))
20 #define ll long long
21
22 using namespace std;
23
24 const int maxn = 100+10;
25 const int INF = 0x3f3f3f3f;
26
27 double dis(double x1,double y1){
28 return sqrt(x1 * x1 + y1 * y1);
29 }
30 int main(){
31 int t;
32 double pi = acos(-1.0);
33 char n[12];
34 cin >> t;
35 while(t--){
36 double ans;
37 double R;
38 int m;
39 cin >> m;
40 scanf ("%lf",&R);
41 ans = 2 * R * pi;
42 while(m--)
43 {
44 double x,y,r;
45 scanf("%lf%lf%lf",&x,&y,&r);
46 double dist = dis(x,y);
47 if(dist + r == R)
48 {
49 ans += 2 * r * pi;
50 }
51 else if(dist >= r + R || dist + r < R)
52 {
53 continue;
54 }
55 else
56 {
57 double del = acos((R * R + dist * dist - r * r) / (2 * dist * R));
58 double si = acos((r * r + dist * dist - R * R) / (2 * dist * r));
59 ans = ans - del * R * 2 + si * r * 2;
60 }
61 }
62 printf("%lf\n",ans);
63 }
64 return 0;
65 }
E - Everything Has Changed HDU - 6354的更多相关文章
- HDU 6354 Everything Has Changed(余弦定理)多校题解
题意:源点处有个圆,然后给你m个圆(保证互不相交.内含),如果源点圆和这些原相交了,就剪掉相交的部分,问你最后周长(最外面那部分的长度). 思路:分类讨论,只有内切和相交会变化周长,然后乱搞就行了.题 ...
- HDU 6354.Everything Has Changed-简单的计算几何、相交相切圆弧的周长 (2018 Multi-University Training Contest 5 1005)
6354.Everything Has Changed 就是计算圆弧的周长,总周长=大圆周长+相交(相切)部分的小圆的弧长-覆盖掉的大圆的弧长. 相交部分小圆的弧长直接求出来对应的角就可以,余弦公式, ...
- codeforces 782B The Meeting Place Cannot Be Changed+hdu 4355+hdu 2438 (三分)
B. The Meeting Place Cannot Be Change ...
- hdu 6354
Problem Description Edward is a worker for Aluminum Cyclic Machinery. His work is operating mechanic ...
- HDU 6351暴力枚举 6354计算几何
Beautiful Now Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)T ...
- 6354 Everything Has Changed
Edward is a worker for Aluminum Cyclic Machinery. His work is operating mechanical arms to cut out d ...
- HDU 6354--Everything Has Changed(判断两圆关系+弧长计算)
题目 题意:首先给定一个以原点为圆心,R为半径的圆,之后在给m个圆,这些圆可能会和原来的圆有所交集,计算开始的圆剩余区域的周长,不包括内部周长. 首先判定两圆关系,如果内含,直接加上圆的周长,如果相交 ...
- hdu 1150 Machine Schedule 最少点覆盖转化为最大匹配
Machine Schedule Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- HDU 1890 区间反转
http://acm.hdu.edu.cn/showproblem.php?pid=1890 Robotic Sort Problem Description Somewhere deep in th ...
- hdu 5412 CRB and Queries
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5412 CRB and Queries Description There are $N$ boys i ...
随机推荐
- Disruptor—4.与Netty的简单应用
大纲 1.服务端代码最佳实践 2.客户端代码最佳实践 3.Netty的高性能核心问题分析 4.基于Disruptor异步化处理Netty的长链接业务 5.Disruptor核心池化封装实现 6.实现接 ...
- AI赋能金融风控:基于机器学习的智能欺诈检测系统实战教程
引言 在数字化转型浪潮中,金融欺诈手段呈现智能化.隐蔽化趋势.传统规则引擎已难以应对复杂多变的欺诈模式,而机器学习技术通过自动学习数据特征,正在重塑金融风控体系.本文将基于Python生态,以信用卡欺 ...
- 【语义分割专栏】2:U-net原理篇(由浅入深)
目录 前言 背景介绍 U-net核心剖析 编码解码结构(U形状) 卷积模式 跳跃连接 add concat 其他细节 overlap-tile策略 弹性形变 U-net模型代码 结语 参考资料 前言 ...
- C++学习思维导图
C++思维导图 整个的思维导图大概的架构如下,Xmind.SVG.PDF格式的下载链接都在下面了,如有需要可自取 Xmind文件分享:https://cnblogs-img.oss-cn-hangzh ...
- php数据结构中的链表
本文由 ChatMoney团队出品 链表的基本概念 链表(Linked List)是一种常见的数据结构,它由一系列节点组成,每个节点除了存储数据外,还包含指向下一个节点的指针.与数组相比,链表在插入和 ...
- 探索 Vue.js 组件的最新特性
引言: Vue.js 作为一款流行的前端框架,始终在不断发展和演进,为开发者带来新的特性和功能,以提升开发效率和用户体验.Vue.js 组件是构建 Vue 应用的基础,其最新特性为开发者提供了更强大的 ...
- 前端开发系列134-进阶篇之脚手架Yue-cli的实现03-download功能
这是系列文章前端脚手架实现的第三篇,本文核心解决当我们通过模板来初始化项目时如何把选定版本的模板文件下载到对应文件夹中的问题. 当我们在拉取模板文件的时候,存在两种情况,一种是直接把初始化项目的模板文 ...
- SCAU 2019年校赛 部分题解
点击下方 veiw code 查看完整代码 18438 First Blood 题意:\(\sum_{i=1}^a\)\(\sum_{j=1}^b\)(i+j) , 求和. 思路:签到题,照着题目A就 ...
- iPaaS 平台在企业中的定位及集成方式
iPaaS 平台在企业中的定位是作为 IT 架构的基础底座能力之一,是构建业务中台的关键组件,同时也为数据中台提供支撑服务.它在企业中承担着连接.集成和管理不同系统.应用程序和数据的重要角色,为企业的 ...
- SciTech-Mathmatics-Analysis: Bouncing Function(震荡函数, 导数±震荡):L'Hospital + 点导数 + 导数 + 连续 + 极限 + 领域 +
SciTech-Mathmatics-Analysis: 考研易错概念: 一点的导数大于0, 能不能推出函数在某邻域单调递增? ✘ 无穷小的倒数,一定为无穷大? ✘ \(\large L'Hospit ...