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.

Input

The first and the only line of the input file contains two numbers n

and r (3≤n≤100, 1≤r≤100) — the number of the outer circles and the radius of the inner circle respectively.

Output

Output a single number R— the radius of the outer circle required for building the required picture.

Your answer will be accepted if its relative or absolute error does not exceed 10−6.

Formally, if your answer is a and the jury's answer is b. Your answer is accepted if and only when |a−b|max(1,|b|)≤10−6.

Sample Input

Input
3 1
Output
6.4641016
Input
6 1
Output
1.0000000
Input
100 100
Output
3.2429391

题目意思:用n个外圆将半径为r的內圆包围起来,使得彼此之间能够相切,问外圆的半径为多少?

解题思路:这是一道几乎题,我们需要引入辅助线
我们设外圆的半径为R 我们可以得到左边(左右其实都一样)那个等腰三角形三角形的斜边长度为R+r,底边为R。又因为的所有圆心连接起来就是一个正多边形,我们知道多边形
内角和为:π*(n-2)(这里外面小圆有多少个,n就为多少,这个可以在草稿本上画一下)。很明显,n个球可以分割成n个这样的等腰三角形。
然后一个底角的角度为π*(n-2)/n/2;现在我们可以根据余弦公式得到:R/(R+r)=cos(a);这样就可以推出R:R=R=r*cos(a)/(1-cos(a));
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define PI acos(-1.0)
using namespace std;
int main()
{
double n,r,x;
scanf("%lf%lf",&n,&r);
x=PI*(n-)/n;
printf("%.7f\n",r*cos(x/)/(-cos(x/)));
return ;
}
 

CF 1100C NN and the Optical Illusion(数学)的更多相关文章

  1. 1100C NN and the Optical Illusion

    推公式,水题.cos()函数是默认弧度制的 #include <iostream> #include <cstring> #include <string> #in ...

  2. CodeForces-1100C NN and the Optical Illusion 简单数学

    题目链接:https://vjudge.net/problem/CodeForces-1100C 题意: 题目给出外部圆的数目n和内部圆的半径r,要求求出外部圆的半径以满足图片要求. 显然这是一道数学 ...

  3. C. NN and the Optical Illusion(几何)

    题目链接:http://codeforces.com/contest/1100/problem/C 题目大意:给你n和r,n指的是有n个圆围在里面的圆的外面,r指的是里面的圆的半径,然后让你求外面的圆 ...

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

    题目链接:NN and the Optical Illusion 题目原文 NN is an experienced internet user and that means he spends a ...

  5. CF A and B and Team Training (数学)

    A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input sta ...

  6. 快速切题CF 158B taxi 构造 && 82A double cola 数学观察 难度:0

    实在太冷了今天 taxi :错误原因1 忽略了 1 1 1 1 和 1 2 1 这种情况,直接认为最多两组一车了 2 语句顺序错 double cola: 忘了减去n的序号1,即n-- B. Taxi ...

  7. Codeforces Round #532(Div. 2) C.NN and the Optical IIIusion

    链接:https://codeforces.com/contest/1100/problem/C 题意: 一个圆球外面由其他圆球包裹,两两相连. 给出n,r. n为外面圆球数量,r为内部圆球半径. 求 ...

  8. CF R639 div 2 E Quantifier Question 数学 dfs 图论

    LINK:Quantifier Question 题面过长 引起不适 读题花了好长时间 对于 和 存在符合不是很熟练 导致很懵逼的做完了. 好在还算很好想.不过wa到了一个坑点上面 自闭一大晌 还以为 ...

  9. cf 12C Fruits(贪心【简单数学】)

    题意: m个水果,n个价格.每种水果只有一个价格. 问如果给每种水果分配价格,使得买的m个水果总价格最小.最大. 输出最小值和最大值. 思路: 贪心. 代码: bool cmp(int a,int b ...

随机推荐

  1. 965. Univalued Binary Tree

    题目来源: https://leetcode.com/problems/univalued-binary-tree/submissions/ 自我感觉难度/真实难度: 题意: 分析: 自己的代码: c ...

  2. php 查看使用多少内存

    方法memory_get_usage 是指当前脚本正在使用的内存 unset只是把内存标记为空闲但并没有释放,要GC程序结束后才会释放 $bytes = memory_get_peak_usage() ...

  3. JavaWeb基础—会话管理之Cookie

    一.什么是会话 打开浏览器,浏览各种资源,点击各种超链接,直至关闭浏览器,整个过程称为会话 二.会话管理的两种技术 1.Cookie 基于客户端.在客户端记录信息来确认用户身份.以cookie的形式写 ...

  4. RMAN中建立Catalog 用数据库的例子

    RMAN中可以备份metadata到control文件,也可以备份metadata到数据库中,此数据库称为catalog database. 本文参考网上文章,建立一个例子: 使用机器: 机器1:ta ...

  5. 成都Uber优步司机奖励政策(4月20日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  6. 5285: [Hnoi2018]寻宝游戏

    5285: [Hnoi2018]寻宝游戏 链接 分析: 从下面依次确定运算符号,然后在确定的过程中,需要确定的位数会逐渐减少.比如最后有一个1,如果在从下往上确定了一个or 1,那么再往前可以随便选了 ...

  7. Merge语句中NULL的陷阱

    NULL表示unknown,不确定值,所以任何值(包括null值)和NULL值比较都是不可知的,在on子句,where子句,Merge或case的when子句中,任何值和null比较的结果都是fals ...

  8. [VB.NET][C#]WAV格式文件头部解析

    简介 WAV 为微软开发的一种声音文件格式,它符合 RIFF(Resource Interchange File Format)文件规范,用于保存 Windows 平台的音频信息资源. 第一节 文件头 ...

  9. UWP Xaml设计器中输入特殊字符

    <TextBox Text="欢迎使用小冰科技最新研发的自然语言处理程序.小冰科技旗下还有强大的人脸识别软件——<微识别>,自动追踪和识别人脸:具有科普性质的.清新脱俗的识 ...

  10. nginx配置转发详解

    nginx各项参数的详细配置 本文主要讲解nginx.conf中server部分配置及多路转发问题: server { listen 9090; server_name 127.0.0.1; #cha ...