爆炸几何之 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的素数一共也只有 ...
随机推荐
- React 实践记录 04 Flux demo
Introduction flux应用架构如下图所示,本文并不是讲述怎么立即做一个酷炫的应用,而是讲述如何依照这种框架,来进行代码的组织. 我们先把这个流程转述为文字:抛开与webAPI的交互不谈,以 ...
- jmeter中通过命令方式生成结果文件
通过命令的方式将jmeter生成的jtl结果文件生成html文件,以便更直观的分析结果数据,以下命令可以放在1个bat文件中取执行. bat文件可以放到jmeter的根目录下. 步骤1: 通过命令方式 ...
- Hibernate学习之简单应用
前言:博主在学到Spring的时候,要开始做项目了,突然觉得好像有点虚,之前学过的Hibernate框架的简单应用好像又忘记了.所以返回来,做个小笔记. 简单来讲,Hibernate框架是利用对象-关 ...
- Scala 的list
9.1 使用列表 列表类型:跟数组一样,列表也是同质化的(homogeneous).即所有元素都要是同种类型. 列表结构:所有列表由两部分组成:Nil 和 ::(cons). 基本操作:主要有三个:h ...
- python:lambda、filter、map、reduce
lambda 为关键字.filter,map,reduce为内置函数. lambda:实现python中单行最小函数. g = lambda x: x * 2 #相当于 def g(x): retur ...
- Vue的安装并在WebStorm中运行
一.Vue的安装需要两个支持分别为:nodejs.npm Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境. Node.js 使用了一个事件驱动.非阻塞式 I/O ...
- C#值类型和引用类型与Equals方法
1. C#的值类型和引用类型 C#的对象里面有两种类型,一个是引用类型,一个是值类型,值类型和引用类型的具体分类可以看下面的分类. 在C#中,不管是引用类型还是值类型,他们都隐式继承Object类 ...
- ios面试题(三)
4.写一个setter方法用于完成@property (nonatomic,retain)NSString *name,写一个setter方法用于完成@property(nonatomic,copy) ...
- [POJ] 3362 Telephone Lines
Telephone Lines Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7978 Accepted: 2885 Descr ...
- MySQL 查询优化之 Index Condition Pushdown
MySQL 查询优化之 Index Condition Pushdown Index Condition Pushdown限制条件 Index Condition Pushdown工作原理 ICP的开 ...