博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
爆炸几何之 CCPC网络赛 I - The Designer (笛卡尔定理)
阅读量:7118 次
发布时间:2019-06-28

本文共 2915 字,大约阅读时间需要 9 分钟。

本文版权归BobHuang和博客园共有,不得转载。如想转载,请联系作者,并注明出处。

 
Nowadays, little 
hahahaha got a problem from his teacher.His teacher wants to design a big logo for the campus with some circles tangent with each other. And now, here comes the problem. The teacher want to draw the logo on a big plane. You could see the example of the graph in the Figure1Figure1 
At first, hahahaha's teacher gives him two bigbig circles, which are tangent with each other. And, then, he wants to add more small circles in the area where is outside of the small circle, but on the other hand, inside the bigger one (you may understand this easily if you look carefully at the Figure1Figure1. 
Each small circles are added by the following principles. 
* you should add the small circles in the order like Figure1Figure1. 
* every time you add a small circle, you should make sure that it is tangented with the other circles (2 or 3 circles) like Figure1Figure1. 
     
The teacher wants to know the total amount of pigment he would use when he creates his master piece.hahahaha doesn't know how to answer the question, so he comes to you. 
TaskTask 
The teacher would give you the number of small circles he want to add in the figure. You are supposed to write a program to calculate the total area of all the small circles. 

InputThe first line contains a integer t(1t1200)t(1≤t≤1200), which means the number of the test cases. For each test case, the first line insist of two integers R1R1 and R2R2 separated by a space (1R1001≤R≤100), which are the radius of the two big circles. You could assume that the two circles are internally tangented. The second line have a simple integer NN (1N10 000 0001≤N≤10 000 000), which is the number of small circles the teacher want to add. 

OutputFor each test case: 
Contains a number in a single line, which shows the total area of the small circles. You should out put your answer with exactly 5 digits after the decimal point (NO SPJ). 
Sample Input

25 414 51

Sample Output

3.141593.14159

这个是题目,很快就看懂了,而且我有了一堆关系可以用,比如第几个圆,还有些相切的关系

但这个题我肯定是要用题解方法做的,不然精度炸飞

援引自百度百科,百度百科来源于一篇论文(见《笛卡尔定理与一类多圆相切问题》(作者:王永喜、李奋平)。)

若平面上四个半径为r
1、r
2、r
3、r
4的圆两两相切于不同点,则其半径满足以下结论:
(1)若四圆两两外切,则
 
 
(2)若半径为r
1、r
2、r
3的圆内切于半径为r
4的圆中,则
 
 
笛卡尔定理在 中也有类似的结论:若五个球的半径是r
i(1,2,...,5),满足任意一个球与其他四个球外切,则
 
 

这个为什么是成立的呢

可以从最简单的推

设三个圆的半径分别是a,b,c

然后就

 

这道题和论文中的这个内容相似

 

把1替换成r,2替换成R就可以对这个图进行求解

有个专业术语叫

 

有些美妙吧

 

#include
using namespace std;const double eps=1e-13;const double PI=acos(-1.0);int main(){ int T; scanf("%d",&T); while(T--) { int R,r,n; scanf("%d%d%d",&R,&r,&n); if(R
eps; i+=2) { ans+=t; if(i+1<=n)ans+=t; double k5=2*(k1+k2+k4)-k3; k3=k4; k4=k5; t=1./k4/k4; } printf("%.5f\n",ans*PI); } return 0;}

本文版权归BobHuang和博客园共有,不得转载。如想转载,请联系作者,并注明出处。

 

转载于:https://www.cnblogs.com/BobHuang/p/7402967.html

你可能感兴趣的文章
Ceph:一个新时代的开始
查看>>
SVN服务器搭建详解
查看>>
Openstack 安装部署指南翻译系列 之 概况
查看>>
【沫沫金】安卓手机版 - 日期控件
查看>>
在Linux使用exec执行命令时报的哪些错
查看>>
在HTML中取得请求中的参数
查看>>
25个好用的Shell脚本常用命令分享
查看>>
Waud.js – 使用HTML5降级处理的Web音频库
查看>>
2.6.29的一个节省内存的补丁
查看>>
酷客多小程序受邀参加 中国县域连锁药店发展峰会
查看>>
Android Dialog Activity
查看>>
ManjarorLinux操作笔记
查看>>
基于Twemproxy的Redis集群方案
查看>>
IIS6.0 + openssl执行版 + Windows2003--配置篇
查看>>
WIN10 64位 JDK的安装
查看>>
与中标软件达成战略合作 瑞星将自主安全做到极致
查看>>
【No.4 变量作用域】
查看>>
利用微信公众号实现zabbix告警
查看>>
Tomcat pool 发布脚本
查看>>
mysql 7下载安装及问题解决
查看>>