2017 ACM-ICPC南宁网络赛: G. Finding the Radius for an Inserted Circle
2017-09-24 17:39
288 查看
题目链接:
https://nanti.jisuanke.com/t/17314
题意:如下图
![](https://oscdn.geek-share.com/Uploads/Images/Content/202012/08/632e09f8052071d6704b334b5fee3ec5)
先输入两个数T和R,代表T次询问和大圆半径R
接下来每次询问输入一个k,求出图中第k小的圆Ck的半径
设第一个小圆的半径为r,图中红线长度为len = (sqrt(3)-1)*R
那么可以得到方程:(len*R-r)²+R²=(R+r)²
解出:r = len²/(2R+2len)
这样第一个圆的半径就求出来了
len -= 2r,继续解方程求出第二个r',依次类推
#include<stdio.h>
#include<math.h>
double ans[11];
int main(void)
{
int T, n, i;
double R, len;
scanf("%d%lf", &T, &R);
len = sqrt(3.0)*R-R;
for(i=1;i<=10;i++)
{
ans[i] = len*len/(2*R+2*len);
len -= 2*ans[i];
}
while(T--)
{
scanf("%d", &n);
printf("%d %d\n", n, (int)ans
);
}
scanf("%*d");
return 0;
}
/*
10
152973.6
1 2 3 4 5 6 7 8 9 10
-1
*/
https://nanti.jisuanke.com/t/17314
题意:如下图
先输入两个数T和R,代表T次询问和大圆半径R
接下来每次询问输入一个k,求出图中第k小的圆Ck的半径
设第一个小圆的半径为r,图中红线长度为len = (sqrt(3)-1)*R
那么可以得到方程:(len*R-r)²+R²=(R+r)²
解出:r = len²/(2R+2len)
这样第一个圆的半径就求出来了
len -= 2r,继续解方程求出第二个r',依次类推
#include<stdio.h>
#include<math.h>
double ans[11];
int main(void)
{
int T, n, i;
double R, len;
scanf("%d%lf", &T, &R);
len = sqrt(3.0)*R-R;
for(i=1;i<=10;i++)
{
ans[i] = len*len/(2*R+2*len);
len -= 2*ans[i];
}
while(T--)
{
scanf("%d", &n);
printf("%d %d\n", n, (int)ans
);
}
scanf("%*d");
return 0;
}
/*
10
152973.6
1 2 3 4 5 6 7 8 9 10
-1
*/
相关文章推荐
- Finding the Radius for an Inserted Circle--2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
- G.Finding the Radius for an Inserted Circle 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 G. Finding the Radius for an Inserted Circle
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 G. Finding the Radius for an Inserted Circle
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛: G. Finding the Radius for an Inserted Circle(笛卡尔定理)
- 【计算几何】【圆反演】计蒜客17314 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 G. Finding the Radius for an Inserted Circle
- Finding the Radius for an Inserted Circle 笛卡尔定理 - 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
- hdu 6158 The Designer && 计蒜客 Finding the Radius for an Inserted Circle 笛卡尔定理应用+韦达定理
- ???Finding the Radius for an Inserted Circle
- hdu 6158 The Designer && 计蒜客 Finding the Radius for an Inserted Circle 笛卡尔定理应用
- L. The Heaviest Non-decreasing Subsequence Problem -最长不降子序列变形nlogn-2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 The Heaviest Non-decreasing Subsequence Problem 最长不下降序列
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 The Heaviest Non-decreasing Subsequence Problem
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛-L. The Heaviest Non-decreasing Subsequence Problem
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛:The Heaviest Non-decreasing Subsequence Problem
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 L. The Heaviest Non-decreasing Subsequence Problem
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 The Heaviest Non-decreasing Subsequence Problem
- 计蒜客 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 The Heaviest Non-decreasing Subsequence Problem
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛:L. The Heaviest Non-decreasing Subsequence Problem
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 L.The Heaviest Non-decreasing Subsequence Problem