NN and the Optical Illusion-光学幻觉 CodeForce1100C 几何

题目链接:NN and the Optical Illusion

题目原文

NN is an experienced internet user and that means he spends a lot of time on the social media. Once he found the following image on the Net, which asked him to compare the sizes of inner circles:

It turned out that the circles are equal. NN was very surprised by this fact, so he decided to create a similar picture himself.

He managed to calculate the number of outer circles ?n and the radius of the inner circle ?r. NN thinks that, using this information, you can exactly determine the radius of the outer circles ?R so that the inner circle touches all of the outer ones externally and each pair of neighboring outer circles also touches each other. While NN tried very hard to guess the required radius, he didn't manage to do that.

Help NN find the required radius for building the required picture. 

题目大意

上面的图,其实中间的两个圆的面积是相等的。要做的是已知中间的圆的半径r,如果外面有n个圆围着中间的圆,求外围圆的半径。

思路

注意一下输出的时候的小数位数即可。

cout默认输出是6位,所以用printf或者设置一下输出精度

题解

 1 #include <iostream>
 2 #include <cmath>
 3 #include <cstdio>
 4 
 5 using namespace std;
 6 
 7 
 8 const double PI=acos((double)-1);
 9 int num, r;
10 
11 int main(int argc, char const *argv[])
12 {
13 
14     cin >> num >> r;
15     double sin_ = sin(PI/num);
16     double ans = r*(sin_ / (1-sin_));
17     printf("%.7f", ans);
18     return 0;
19 }

 

转载于:https://www.cnblogs.com/SaltyFishQF/p/10393056.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值