爆炸几何之 CCPC网络赛 I - The Designer (笛卡尔定理)
本文版权归BobHuang和博客园共有,不得转载。如想转载,请联系作者,并注明出处。
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(1≤t≤1200)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 (1≤R≤1001≤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 (1≤N≤10 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
2
5 4
1
4 5
1
Sample Output
3.14159
3.14159
这个是题目,很快就看懂了,而且我有了一堆关系可以用,比如第几个圆,还有些相切的关系
但这个题我肯定是要用题解方法做的,不然精度炸飞
援引自百度百科,百度百科来源于一篇论文(见《笛卡尔定理与一类多圆相切问题》(作者:王永喜、李奋平)。)

;

。
这个为什么是成立的呢
可以从最简单的推
设三个圆的半径分别是a,b,c
然后就
这道题和论文中的这个内容相似
把1替换成r,2替换成R就可以对这个图进行求解
有个专业术语叫Pappus chain
有些美妙吧
#include<bits/stdc++.h>
using namespace std;
const double eps=1e-;
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<r)swap(R,r);
double k1=-1.0/R,k2=1.0/r,k3=1.0/(R-r);
double k4=k1+k2+k3;
double ans=(R-r)*(R-r);
n--;
double t=./k4/k4;
for(int i=; i<=n&&t>eps; i+=)
{
ans+=t;
if(i+<=n)ans+=t;
double k5=*(k1+k2+k4)-k3;
k3=k4;
k4=k5;
t=./k4/k4;
}
printf("%.5f\n",ans*PI);
}
return ;
}
本文版权归BobHuang和博客园共有,不得转载。如想转载,请联系作者,并注明出处。
爆炸几何之 CCPC网络赛 I - The Designer (笛卡尔定理)的更多相关文章
- 【2018 CCPC网络赛】1003 - 费马小定理
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6440 这题主要是理解题意: 题意:定义一个加法和乘法,使得 (m+n)p = mp+np; 其中给定 ...
- 树形DP CCPC网络赛 HDU5834 Magic boy Bi Luo with his excited tree
// 树形DP CCPC网络赛 HDU5834 Magic boy Bi Luo with his excited tree // 题意:n个点的树,每个节点有权值为正,只能用一次,每条边有负权,可以 ...
- (四面体)CCPC网络赛 HDU5839 Special Tetrahedron
CCPC网络赛 HDU5839 Special Tetrahedron 题意:n个点,选四个出来组成四面体,要符合四面体至少四条边相等,若四条边相等则剩下两条边不相邻,求个数 思路:枚举四面体上一条线 ...
- 2018 CCPC网络赛
2018 CCPC网络赛 Buy and Resell 题目描述:有一种物品,在\(n\)个地点的价格为\(a_i\),现在一次经过这\(n\)个地点,在每个地点可以买一个这样的物品,也可以卖出一个物 ...
- ccpc 网络赛 hdu 6155
# ccpc 网络赛 hdu 6155(矩阵乘法 + 线段树) 题意: 给出 01 串,要么询问某个区间内不同的 01 子序列数量,要么把区间翻转. 叉姐的题解: 先考虑怎么算 \(s_1, s_2, ...
- 2018年 CCPC 网络赛 赛后总结
历程:由于只是网络赛,所以今天就三开了.一开始的看题我看了d题,zz和jsw从头尾看起来,发现c题似乎可做,和费马大定理有关,于是和zz一起马上找如何计算勾股数的方法,比较慢的A掉了,而jsw此时看了 ...
- 2019杭电多校&CCPC网络赛&大一总结
多校结束了, 网络赛结束了.发现自己还是太菜了,多校基本就是爆零和签到徘徊,第一次打这种高强度的比赛, 全英文,知识点又很广,充分暴露了自己菜的事实,发现数学还是很重要的.还是要多刷题,少玩游戏. 网 ...
- hdu 6152 : Friend-Graph (2017 CCPC网络赛 1003)
题目链接 裸的结论题.百度 Ramsey定理.刚学过之后以为在哪也不会用到23333333333,没想到今天网络赛居然出了.顺利在题面更改前A掉~~~(我觉得要不是我开机慢+编译慢+中间暂时死机,我还 ...
- hdu 5833 Zhu and 772002 ccpc网络赛 高斯消元法
传送门:hdu 5833 Zhu and 772002 题意:给n个数,每个数的素数因子不大于2000,让你从其中选则大于等于1个数相乘之后的结果为完全平方数 思路: 小于等于2000的素数一共也只有 ...
随机推荐
- ES-windos环境搭建(3)-kibana
简介 Kibana是一个为ElasticSearch 提供的数据分析的 Web 接口.可使用它对日志进行高效的搜索.可视化.分析等各种操作. 下载 打开elasticseach官网,单击downloa ...
- 用户登陆界面(jquery)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 【Web应用-FTP】FTP 容量显示说明
现象描述 Azure 门户显示的文件系统存储容量跟网站本身的磁盘空间不符. 问题分析 Azure Web 应用的文件系统存储用量和网站本身有关,具体容量如下所示: 但目前门户预览中关于 FTP 的容量 ...
- Android学习总结(五)———— BroadcastReceiver(广播接收器)的基本概念和两种注册广播方式
我们学完了Android四大组件的Activity和Service了,接下来我们一起来学习Android四大组件的第三个吧:BroadcastReceiver(广播接收者),计划如下图: 一.Broa ...
- 一个制作Xcode5插件的模板
原Github地址:https://github.com/kattrali/Xcode5-Plugin-Template 安装将 本工成复制到~/Library/Developer/Xcode/Tem ...
- centos7设置sshd端口,firewall,selinux设置
https://blog.csdn.net/qq_31927797/article/details/81095829 #停止firewallsystemctl stop firewalld.servi ...
- webuploader项目中多图片上传实例
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- 初识 Hibernate
Hibernate 框架 1.1 什么是框架? 框架是一个提供了可重用的公共结构半成品. 2.1 关于Hibernate Hibernate是数据持久层的一个轻量级框架.数据持久层的框架有很多 ...
- java在线聊天项目0.6版 解决客户端关闭后异常问题 dis.readUTF()循环读取已关闭的socket
服务端对try catch finally重新进行了定义,当发生异常,主动提示,或关闭出现异常的socket 服务器端代码修改如下: package com.swift; import java.io ...
- CSS规范(OOCSS SMACSS BEM)
Css规范 OOCSS SMACSS BEM OOCSS(Object Oriented CSS)面向对象的css 主要分成四个部分 Template :模板 Grids :栅格布局 Module : ...