G.Finding the Radius for an Inserted Circle 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
地址:https://nanti.jisuanke.com/t/17314
题目:
Three circles C_{a}Ca, C_{b}Cb, and C_{c}Cc, all with radius RR and tangent to each other, are located in two-dimensional space as shown in Figure 11. A smaller circle C_{1}C1 with radius R_{1}R1 (R_{1}<RR1<R) is then inserted into the blank area bounded by C_{a}Ca, C_{b}Cb, and C_{c}Cc so that C_{1}C1 is tangent to the three outer circles, C_{a}Ca, C_{b}Cb, and C_{c}Cc. Now, we keep inserting a number of smaller and smaller circles C_{k}\ (2 \leq k \leq N)Ck (2≤k≤N) with the corresponding radius R_{k}Rk into the blank area bounded by C_{a}Ca, C_{c}Cc and C_{k-1}Ck−1 (2 \leq k \leq N)(2≤k≤N), so that every time when the insertion occurs, the inserted circle C_{k}Ck is always tangent to the three outer circles C_{a}Ca, C_{c}Cc and C_{k-1}Ck−1, as shown in Figure 11
Figure 1.
(Left) Inserting a smaller circle C_{1}C1 into a blank area bounded by the circle C_{a}Ca, C_{b}Cb and C_{c}Cc.
(Right) An enlarged view of inserting a smaller and smaller circle C_{k}Ck into a blank area bounded by C_{a}Ca, C_{c}Cc and C_{k-1}Ck−1 (2 \leq k \leq N2≤k≤N), so that the inserted circle C_{k}Ck is always tangent to the three outer circles, C_{a}Ca, C_{c}Cc, and C_{k-1}Ck−1.
Now, given the parameters RR and kk, please write a program to calculate the value of R_{k}Rk, i.e., the radius of the k-thk−th inserted circle. Please note that since the value of R_kRk may not be an integer, you only need to report the integer part of R_{k}Rk. For example, if you find that R_{k}Rk = 1259.89981259.8998 for some kk, then the answer you should report is 12591259.
Another example, if R_{k}Rk = 39.102939.1029 for some kk, then the answer you should report is 3939.
Assume that the total number of the inserted circles is no more than 1010, i.e., N \leq 10N≤10. Furthermore, you may assume \pi = 3.14159π=3.14159. The range of each parameter is as below:
1 \leq k \leq N1≤k≤N, and 10^{4} \leq R \leq 10^{7}104≤R≤107.
Input Format
Contains l + 3l+3 lines.
Line 11: ll ----------------- the number of test cases, ll is an integer.
Line 22: RR ---------------- RR is a an integer followed by a decimal point,then followed by a digit.
Line 33: kk ---------------- test case #11, kk is an integer.
\ldots…
Line i+2i+2: kk ----------------- test case # ii.
\ldots…
Line l +2l+2: kk ------------ test case #ll.
Line l + 3l+3: -1−1 ---------- a constant -1−1 representing the end of the input file.
Output Format
Contains ll lines.
Line 11: kk R_{k}Rk ----------------output for the value of kk and R_{k}Rk at the test case #11, each of which should be separated by a blank.
\ldots…
Line ii: kk R_{k}Rk ----------------output for kk and the value of R_{k}Rk at the test case # ii, each of which should be separated by a blank.
Line ll: kk R_{k}Rk ----------------output for kk and the value ofR_{k}Rk at the test case # ll, each of which should be separated by a blank.
样例输入
1
152973.6
1
-1
样例输出
1 23665
题目来源
思路:
圆的反演。
很容易想到把上面两大圆的切点作为反演中心,这样会得到下图。
绿色的是反演前的圆,黄色的是反演后的图形,两个大圆成了平行直线,下面的大圆成了直线间的小圆,后面添加的圆都在这个小圆的下面。
所以求出小圆的圆心的y即可,然后反演回去可以得到半径。
#include <bits/stdc++.h> using namespace std; #define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int,int> PII;
const double eps=1e-;
const double PI=acos(-1.0);
const int K=1e6+;
const int mod=1e9+; int main(void)
{
double r,x,y,ls,dis,ans[];
int t;
cin>>t>>r;
x=0.5*r,ls=-0.5*sqrt(3.0)*r;
dis=x*x+ls*ls;
ls=ls/dis;
r=1.0/(*r);
for(int i=;i<=;i++)
{
y=ls-r*;
ans[i]=0.5*(1.0/(y-r)-1.0/(y+r));
ls=y;
}
for(int i=,k;i<=t;i++)
scanf("%d",&k),printf("%d %d\n",k,(int)ans[k]);
return ;
}
G.Finding the Radius for an Inserted Circle 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛的更多相关文章
- 【计算几何】【圆反演】计蒜客17314 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 G. Finding the Radius for an Inserted Circle
题意:给你三个半径相同的圆,它们切在一起,然后让你往缝里一个一个地塞圆,问你塞到第k个的半径是多少. 就把上面那两个圆的切点当成反演中心,然后会反演成这个样子,两个平行直线和一个圆. 然后就是往那个圆 ...
- ACM ICPC 2018 青岛赛区 部分金牌题题解(K,L,I,G)
目录: K Airdrop I Soldier Game L Sub-cycle Graph G Repair the Artwork ———————————————————— ps:楼主脑残有点严 ...
- hdu 4046 2011北京赛区网络赛G 线段树 ***
还带这么做的,卧槽,15分钟就被A了的题,居然没搞出来 若某位是1,则前两个为wb,这位就是w #include<cstdio> #include<cstring> #defi ...
- hdu 4027 2011上海赛区网络赛G 线段树 成段平方根 ***
不能直接使用成段增减的那种,因为一段和的平方根不等于平方根的和,直接记录是否为1,是1就不需要更新了 #include<cstdio> #include<iostream> # ...
- 2017 ACM/ICPC 沈阳 G题 Infinite Fraction Path
The ant Welly now dedicates himself to urban infrastructure. He came to the kingdom of numbers and s ...
- ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 G. Garden Gathering
Problem G. Garden Gathering Input file: standard input Output file: standard output Time limit: 3 se ...
- 2016ACM/ICPC亚洲区沈阳站 - A/B/C/E/G/H/I - (Undone)
链接:传送门 A - Thickest Burger - [签到水题] ACM ICPC is launching a thick burger. The thickness (or the heig ...
- HDU 4733 G(x) (2013成都网络赛,递推)
G(x) Time Limit: 2000/500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- 计蒜客 30996.Lpl and Energy-saving Lamps-线段树(区间满足条件最靠左的值) (ACM-ICPC 2018 南京赛区网络预赛 G)
G. Lpl and Energy-saving Lamps 42.07% 1000ms 65536K During tea-drinking, princess, amongst other t ...
随机推荐
- python2.0_s12_day9之day8遗留知识(queue队列&生产者消费者模型)
4.线程 1.语法 2.join 3.线程锁之Lock\Rlock\信号量 4.将线程变为守护进程 5.Event事件 * 6.queue队列 * 7.生产者消费者模型 4.6 queue队列 que ...
- 线程间通信:Queue
线程间使用队列来互相交换数据,数据可以是字符串 .列表 .元组等,Queue 是提供队列操作的模块,常见的队列如下: FIFO:First In First Out 先进先出队列,也就是最先放进去的数 ...
- 《C++ Primer Plus》第13章 类继承 笔记
类继承通过使用已有的类(基类)定义新的来(派生类),使得能够根据需要修改编程代码.共有继承建立is-a关系,这意味着派生类对象也应该是某种基类对象.作为is-a模型的一部分,派生类继承基类的数据称源和 ...
- zookeeper-端口说明
一.zookeeper有三个端口(可以修改) 1.2181 2.3888 3.2888 二.3个端口的作用 1.2181:对cline端提供服务 2.3888:选举leader使用 3.2888:集群 ...
- setTimeOut一些注意的地方
for (var i = 0; i < data.length; i++) { var flashID = data[i].ID; //setTimeOut(removeFlashDiv(fla ...
- Ubuntu 14.04.02 安装openvswitch-2.3.1
Open vSwitch安装 安装好操作系统 # lsb_release -a LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:c ...
- centos7 ubuntu14 添加sudo 权限 ,禁用每次sudo 需要输入密码
安装完centos7后,默认没有启用sudo,首先应该是对sudo进行设置.sudo的作用就是使当前非root用户在使用没有权限的命令 时,直接在命令前加入sudo,在输入自己当前用户的密码就可以完成 ...
- IE8及以下的数组处理与其它浏览器的不同
在解决search-box的bug时,由于IE8-的数组处理与其它浏览器的不同,而导致报错. 示例:arr=[1,3,3,]; 当数组的最后是一个逗号时: IE9+默认 arr=[1,3,3];也就是 ...
- Linux系统下编译连接C源代码
gcc test.c -o test 一步到位的编译指令 得到 test 文件 gcc test.c 得到 test.out 文件 gcc -g -c test.c -o test 只生成目标文件(. ...
- elk日志分析与发掘深入分析
elk日志分析与挖掘深入分析 1 为什么要做日志采集? 2 挖财自己的日志采集和分析体系应该怎么建? 2.1 日志的采集 2.2 日志的汇总与过滤 2.3 日志的存储 2.4 日志的分析与查询 3 需 ...