圆相切半径4园

Billyshuai Billyshuai     2022-09-20     190

关键词:

 

Three circles CaC_{a}Ca​​, CbC_{b}Cb​​, and CcC_{c}Cc​​, all with radius RRR and tangent to each other, are located in two-dimensional space as shown in Figure 111. A smaller circle C1C_{1}C1​​ with radius R1R_{1}R1​​ (R1<RR_{1}<RR1​​<R) is then inserted into the blank area bounded by CaC_{a}Ca​​, CbC_{b}Cb​​, and CcC_{c}Cc​​ so that C1C_{1}C1​​ is tangent to the three outer circles, CaC_{a}Ca​​, CbC_{b}Cb​​, and CcC_{c}Cc​​. Now, we keep inserting a number of smaller and smaller circles Ck (2≤k≤N)C_{k}\ (2 \leq k \leq N)Ck​​ (2kN) with the corresponding radius RkR_{k}Rk​​ into the blank area bounded by CaC_{a}Ca​​, CcC_{c}Cc​​ and Ck−1C_{k-1}Ck1​​ (2≤k≤N)(2 \leq k \leq N)(2kN), so that every time when the insertion occurs, the inserted circle CkC_{k}Ck​​ is always tangent to the three outer circles CaC_{a}Ca​​, CcC_{c}Cc​​ and Ck−1C_{k-1}Ck1​​, as shown in Figure 111

Figure 1.

(Left) Inserting a smaller circle C1C_{1}C1​​ into a blank area bounded by the circle CaC_{a}Ca​​, CbC_{b}Cb​​ and CcC_{c}Cc​​.

(Right) An enlarged view of inserting a smaller and smaller circle CkC_{k}Ck​​ into a blank area bounded by CaC_{a}Ca​​, CcC_{c}Cc​​ and Ck−1C_{k-1}Ck1​​ (2≤k≤N2 \leq k \leq N2kN), so that the inserted circle CkC_{k}Ck​​ is always tangent to the three outer circles, CaC_{a}Ca​​, CcC_{c}Cc​​, and Ck−1C_{k-1}Ck1​​.

Now, given the parameters RRR and kkk, please write a program to calculate the value of RkR_{k}Rk​​, i.e., the radius of the k−thk-thkth inserted circle. Please note that since the value of RkR_kRk​​ may not be an integer, you only need to report the integer part of RkR_{k}Rk​​. For example, if you find that RkR_{k}Rk​​ = 1259.89981259.89981259.8998 for some kkk, then the answer you should report is 125912591259.

Another example, if RkR_{k}Rk​​ = 39.102939.102939.1029 for some kkk, then the answer you should report is 393939.

Assume that the total number of the inserted circles is no more than 101010, i.e., N≤10N \leq 10N10. Furthermore, you may assume π=3.14159\pi = 3.14159π=3.14159. The range of each parameter is as below:

1≤k≤N1 \leq k \leq N1kN, and 104≤R≤10710^{4} \leq R \leq 10^{7}104​​R107​​.

Input Format

Contains l+3l + 3l+3 lines.

Line 111: lll ----------------- the number of test cases, lll is an integer.

Line 222: RRR ---------------- RRR is a an integer followed by a decimal point,then followed by a digit.

Line 333: kkk ---------------- test case #111, kkk is an integer.

…\ldots

Line i+2i+2i+2: kkk ----------------- test case # iii.

…\ldots

Line l+2l +2l+2: kkk ------------ test case #lll.

Line l+3l + 3l+3: −1-11 ---------- a constant −1-11 representing the end of the input file.

Output Format

Contains lll lines.

Line 111: kkk RkR_{k}Rk​​ ----------------output for the value of kkk and RkR_{k}Rk​​ at the test case #111, each of which should be separated by a blank.

…\ldots

Line iii: kkk RkR_{k}Rk​​ ----------------output for kkk and the value of RkR_{k}Rk​​ at the test case # iii, each of which should be separated by a blank.

Line lll: kkk RkR_{k}Rk​​ ----------------output for kkk and the value ofRkR_{k}Rk​​ at the test case # lll, each of which should be separated by a blank.

样例输入

1
152973.6
1
-1

样例输出

1 23665


 

 

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
    int T,n;
    double R;
    while(scanf("%d",&T),T!=-1){
        scanf("%lf",&R);
        while(T--){
            scanf("%d",&n);
            double k1=1/R,k2=1/R,k3=1/R;
            double ans;
            for(int i=0;i<n;++i) {
                double B=-2*(k1+k2+k3);
                double C=-(k1+k2+k3)*(k1+k2+k3)+2*(k1*k1+k2*k2+k3*k3);
                double D=B*B-4*C;
                double k4=(-B+sqrt(D))/2;
                ans=1/k4;
                k3=k4;
            }
            printf("%d %d\n",n,floor(ans));
        }
    }
}

 


cf887elittlebrother二分+几何

...和一条线段,保证圆和圆、圆和线段所在直线不相交,不相切,不包含。求一个过线段两端点的圆,满足不和任何圆相交(可以相切、包含)。问圆的最小半径。n<=100000题解:比较显然的二分题。由于新圆的半径一定在线段的... 查看详情

uva12304///圆的综合题圆的模板(代码片段)

...给出一条直线,一个点p,指定半径r,求经过点p的与直线相切的半径为r的圆;⑤给出两条直线,求与这两条直线相切的圆;⑥给出两个圆,求同时与这两个圆相切的圆; 贴一下圆的 查看详情

教您用几何画板画相切的圆

...心距与两半径的长度来确定的。那么如果想画出三个两两相切的圆,要怎样画呢?这时我们可以利用几何画板,画出既标准又美观的图形。最新版几何画板软件获取地址:http://wm.makeding.com/iclk/?zoneid=17783具体的操作步骤如下:步... 查看详情

圆排列问题

...不等的圆c1c2c3c4要将n个圆排进一个矩形框中,且要求底边相切。找出有最小长度的圆排列。    例如:当n=3,且所给的3个圆半径分别为1,1,2时,这3个圆的最小长度的圆排列最小长度为2+4根号2. 算法设计: &nb... 查看详情

两圆相交求面积hdu5120

转载 两圆相交分如下集中情况:相离、相切、相交、包含。设两圆圆心分别是O1和O2,半径分别是r1和r2,设d为两圆心距离。又因为两圆有大有小,我们设较小的圆是O1。相离相切的面积为零,代码如下: [cpp]viewplaincopy&nbs... 查看详情

hdu5531(代码片段)

...心画圆(半径可为0)每个顶点的圆要和它相邻顶点的圆相切(不相邻的可相交)求所有圆的最小面积总和并给出所有圆的半径设半径为r1r2...rn,顶点距离为L1L2...Ln 当顶点数为奇数时由r1+r2=L1r2+r3=L2......rn+r1=Ln可得r1+r1=L1-L2+L3-..... 查看详情

poj2932coneology计算最外层圆个数(代码片段)

...要求的圆的个数和编号。n<=40000. (注意此题无相交相切!!!)工具:扫描线+set 中心思想:边界分左右端点,如图,当扫描线与k号圆左端点相切,之前用set维护一个y纵坐标的二叉树,那我们在二叉树中查找离k号圆... 查看详情

使用matlab到球体中心的最小距离

...)和G,并在圆平面上创建90°投影。最小距离是投影与圆相切 查看详情

c++判断两圆位置关系

对于两圆的位置一般有五种关系:(1)外离:两圆的半径之和小于两圆圆心距离(2)外切:两圆的半径之和等于两圆圆心距离(3)相交:两圆的半径之和大于两圆圆心距离,两圆圆心距离大于两圆半径之差(4)内切:两圆的半径之差等于两圆圆... 查看详情

创建一个圆类circle的对象,分别设置圆的半径计算并分别显示圆半径圆面积圆周长。(代码片段)

...有:①一个成员变量Radius(私有,浮点型);//存放圆的半径;②两个构造方法Circle()//将半径设为0Circle(doubler)//创建Circle对象时将半径初始化为r③三个成员方法doublegetArea()//计算圆的面积doublegetPerimeter()//计算圆的周长voidshow()//... 查看详情

autocad这个图怎么画?

...?R2/R14/R24的圆点怎么找出来的?由于(R24)与圆(R12)相切,所以(R24的圆心)与(R12的圆心)距离为36;以(R12的圆心)为圆心,作(R36)的圆,与直线的交点就是(R24的圆心);同样找出R14的圆心。至于R2,只要(相切,相... 查看详情

用神经网络预测圆的半径

】用神经网络预测圆的半径【英文标题】:PredictingradiusofcirclewithNeuralNetwork【发布时间】:2020-10-1818:55:43【问题描述】:我正在以圆形生成均匀分布的数据点,其中每个圆的半径也是均匀生成的。这些圆圈如下所示:均匀分布的... 查看详情

python语言编程

...心的圆上一点,编写一个程序,输出过(x,y)点且与圆相切的直线方程参考技术A设已知圆上一点坐标为(x1,y1),圆的半径为r若斜率不存在,则切线方程为:x=x1若存在且斜率为K,则切线方程为:y-y1=k(x-x1)则圆心到切线的距离d=r(半... 查看详情

cf744dhongcowdrawsacircle二分+几何

...考虑半径为inf的情况。显然所求的圆一定是要与某个蓝点相切的。我们可以先枚举这个蓝点,然后二分答案。当半径已知、一个点固定时,圆的可能位置只能是绕着一个点旋转得到的结果,其余的所有点都对应着极角上的一段区... 查看详情

如何用增加的半径填充圆?

】如何用增加的半径填充圆?【英文标题】:Howtofillcirclewithincreasingradius?【发布时间】:2011-07-1706:13:30【问题描述】:作为更复杂算法的一部分,我需要以下内容:假设我在离散网格上绘制了一个半径为R1的圆(图片)(下图中... 查看详情

输入圆的半径,计算并输出圆的周长和面积

   查看详情

cf1059dnaturereserve(精度处理,计算几何,二分)(代码片段)

...解。我们在将所有$y$值都变为正数方便处理如果圆与$x$轴相切,则该圆的一条半径垂直于$x$轴。于是我们可以二分半径$R$ 那么圆心的纵坐标是确定的,那么我们如何判断该半径能否覆盖所有圆呢?如图我们根据勾股定理算出... 查看详情

c++设计一个圆类,计算圆的面积和周长。

1.定义一个园(circle),属性为半径(radins)、圆周长和面积,操作为输入半径并计算周长、面积、输出半径和面积。要求定义构造函数(以半径为参数。默认值为0,周长和面积在构造函数中生成)和复制构造函数。2.定义一个point... 查看详情