题意:

给定一个平面和一个(0,0)为中心的大圆,有n个小圆保证没有两两之间相交与覆盖整个大圆的情况,求小圆覆盖后大圆的周长并

1≤m≤100, -1e3<=x[i],y[i]<=1e3,

思路:

高中数学几何题,余弦定理算圆心角

每加一个圆就把覆盖掉的周长减掉,增加的周长加上

把内含,外切,不相交的三种情况特判掉

acos算出来的是弧度

考试时候不会推也是醉了

 #include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
#define fi first
#define se second
#define MP make_pair
#define N 11000000
#define MOD 1000000007
#define eps 1e-8
#define pi acos(-1) int gao(double x)
{
if(fabs(x)<eps) return ;
if(x<eps) return -;
else return ;
} int read()
{
int v=,f=;
char c=getchar();
while(c<||<c) {if(c=='-') f=-; c=getchar();}
while(<=c&&c<=) v=(v<<)+v+v+c-,c=getchar();
return v*f;
} int main()
{ int cas;
scanf("%d",&cas);
while(cas--)
{
int n;
double R;
scanf("%d%lf",&n,&R);
double ans=R*pi*;
for(int i=;i<=n;i++)
{
double x,y,r;
scanf("%lf%lf%lf",&x,&y,&r);
double l=sqrt(x*x+y*y);
if(gao(l-r-R)>=||gao(l-R+r)<) continue;
if(gao(l-R+r)==)
{
ans+=r*pi*;
continue;
}
double s1=(R*R+l*l-r*r)/(*R*l);
double s2=(r*r+l*l-R*R)/(*r*l);
s1=*acos(s1);
s2=*acos(s2);
ans+=r*s2;
ans-=R*s1;
}
printf("%.8f\n",ans);
}
return ;
}

【HDOJ6354】Everything Has Changed(计算几何)的更多相关文章

  1. hdu6354 杭电第五场 Everything Has Changed 计算几何

    Everything Has Changed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java ...

  2. HDU 6354.Everything Has Changed-简单的计算几何、相交相切圆弧的周长 (2018 Multi-University Training Contest 5 1005)

    6354.Everything Has Changed 就是计算圆弧的周长,总周长=大圆周长+相交(相切)部分的小圆的弧长-覆盖掉的大圆的弧长. 相交部分小圆的弧长直接求出来对应的角就可以,余弦公式, ...

  3. CentOS:ECDSA host key "ip地址" for has changed and you have requested strict checking(转)

    原文地址:http://blog.csdn.net/ausboyue/article/details/52775281 Linux SSH命令错误:ECDSA host key "ip地址& ...

  4. ACM/ICPC 之 计算几何入门-叉积-to left test(POJ2318-POJ2398)

    POJ2318 本题需要运用to left test不断判断点处于哪个分区,并统计分区的点个数(保证点不在边界和界外),用来做叉积入门题很合适 //计算几何-叉积入门题 //Time:157Ms Me ...

  5. 【异常】INFO: TopologyManager: EndpointListener changed ...

    5月份做云部署,在调试CSS系统时,出现启动系统时,卡死情况,后台日志如下: May 03, 2016 2:34:52 AM org.apache.cxf.dosgi.topologymanager. ...

  6. HDU 2202 计算几何

    最大三角形 Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submi ...

  7. tomcat 7 WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []

    tomcat 7 WARNING: A context path must either be an empty string or start with a '/' and do not end w ...

  8. ACM 计算几何中的精度问题(转)

    http://www.cnblogs.com/acsmile/archive/2011/05/09/2040918.html 计算几何头疼的地方一般在于代码量大和精度问题,代码量问题只要平时注意积累模 ...

  9. Centos 7 mysql Buffered warning: Changed limits: max_connections: 214 解决方法

    Everytime I restart MySQL I have this warning: [Warning] Buffered warning: Changed limits: max_conne ...

随机推荐

  1. UVA 247 - Calling Circles (Floyd)

    互相可以打电话是一个传递关系,所以Floyd求传递封包,dfs找一个尽量大的圈. #include<bits/stdc++.h> using namespace std; ; map< ...

  2. 2017四川省赛E题( Longest Increasing Subsequence)

    提交地址: https://www.icpc-camp.org/contests/4rgOTH2MbOau7Z 题意: 给出一个整数数组,F[i]定义为以i结尾的最长上升子序列,然后问以此删除掉第i个 ...

  3. 单源最短路Dijstra

    #include<iostream> #include<cstring> #define INF 0x3f3f3f3f using namespace std; ][],d[] ...

  4. VC-基础:隐藏不安全函数的warning-_CRT_SECURE_NO_WARNINGS

    >tmp.cpp(): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strc ...

  5. call和apply方法的异同

    基本作用:改变对象的执行上下文. this指向执行上下文.(执行环境) this指向的永远是调用该方法的对象 function func(){ this.a=1; console.log(this.a ...

  6. python之set (集合)

    1. 集合是什么 set {1,2,3} 2. 集合怎么用 去重 集合是无序的 集合就是一个没有值的字典,遵循:唯一,无序,元素要求可哈希(不可变) 集合是可变的 2.1 增 方法一: s.updat ...

  7. Spring启动流程—源码解读

    https://blog.csdn.net/yangliuhbhd/article/details/80790761 Spring的AbstractApplicationContext的refresh ...

  8. iOS使用技巧---高效使用你的xcode

    推荐一遍好文章:绝对可以学到关于xcode的很多哟 转载自cocoachina: http://www.cocoachina.com/ios/20140731/9284.html

  9. 牛客网NOIP赛前集训营-提高组(第三场)A 管道维修

    https://www.nowcoder.com/acm/contest/174/A 这个的话  一个位置被清理的时间就是它到空白格子/边界的最短路对吧qww 然后求期望的话 假设它在第i步被清理掉的 ...

  10. 离线web-ApplicationCache

    https://www.html5rocks.com/en/tutorials/appcache/beginner/ http://diveintohtml5.info/offline.html#fa ...