CF 1100C 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.
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
3 1
6.4641016
6 1
1.0000000
100 100
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(数学)的更多相关文章
- 1100C NN and the Optical Illusion
推公式,水题.cos()函数是默认弧度制的 #include <iostream> #include <cstring> #include <string> #in ...
- CodeForces-1100C NN and the Optical Illusion 简单数学
题目链接:https://vjudge.net/problem/CodeForces-1100C 题意: 题目给出外部圆的数目n和内部圆的半径r,要求求出外部圆的半径以满足图片要求. 显然这是一道数学 ...
- C. NN and the Optical Illusion(几何)
题目链接:http://codeforces.com/contest/1100/problem/C 题目大意:给你n和r,n指的是有n个圆围在里面的圆的外面,r指的是里面的圆的半径,然后让你求外面的圆 ...
- NN and the Optical Illusion-光学幻觉 CodeForce1100C 几何
题目链接:NN and the Optical Illusion 题目原文 NN is an experienced internet user and that means he spends a ...
- 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 ...
- 快速切题CF 158B taxi 构造 && 82A double cola 数学观察 难度:0
实在太冷了今天 taxi :错误原因1 忽略了 1 1 1 1 和 1 2 1 这种情况,直接认为最多两组一车了 2 语句顺序错 double cola: 忘了减去n的序号1,即n-- B. Taxi ...
- Codeforces Round #532(Div. 2) C.NN and the Optical IIIusion
链接:https://codeforces.com/contest/1100/problem/C 题意: 一个圆球外面由其他圆球包裹,两两相连. 给出n,r. n为外面圆球数量,r为内部圆球半径. 求 ...
- CF R639 div 2 E Quantifier Question 数学 dfs 图论
LINK:Quantifier Question 题面过长 引起不适 读题花了好长时间 对于 和 存在符合不是很熟练 导致很懵逼的做完了. 好在还算很好想.不过wa到了一个坑点上面 自闭一大晌 还以为 ...
- cf 12C Fruits(贪心【简单数学】)
题意: m个水果,n个价格.每种水果只有一个价格. 问如果给每种水果分配价格,使得买的m个水果总价格最小.最大. 输出最小值和最大值. 思路: 贪心. 代码: bool cmp(int a,int b ...
随机推荐
- servlet使用
一.使用IDEAL创建项目 1) 2) 3) 4) 5) 6) 7) 8) 9) 二.路径介绍: 配置文件: servlet配置文件: package ser_Test; import javax.s ...
- PAT乙级1002
1002 写出这个数 (20 分) 读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字. 输入格式: 每个测试输入包含 1 个测试用例,即给出自然数 n 的值.这里保证 n 小于 ...
- P1446 [HNOI2008]Cards
题目描述 小春现在很清闲,面对书桌上的N张牌,他决定给每张染色,目前小春只有3种颜色:红色,蓝色,绿色.他询问Sun有多少种染色方案,Sun很快就给出了答案. 进一步,小春要求染出Sr张红色,Sb张蓝 ...
- Mac OS X 命令行用户应当知道的八个终端工具
原文链接:Eight Terminal Utilities Every OS X Command Line User Should Know OS X 的Terminal 终端开辟了强大的UNIX实 ...
- SQLite加密方式 [转]
关于SQLite SQLite是一个轻量的.跨平台的.开源的数据库引擎,它的在读写效率.消耗总量.延迟时间和整体简单性上具有的优越性,使其成为移动平台数据库的最佳解决方案(如iOS.Android). ...
- USB协议规范文档简介
USB协议规范文档简介 USB驱动开发必须对USB相关的协议规范有一定程度的了解,理解得越深,遇到的问题就会越少,解决问题的速度也就越快. 工欲善其行,必先利其器.USB协议规范就是USB ...
- 【Linux】LVM逻辑卷管理和RAID
LVM概述: 是对磁盘分区进行管理的一种机制 是一种将一个或多个硬盘的分区在逻辑上集合,相当于一个大硬盘来使用,当硬盘的空间不 够使用的时候,可以继续将其它的硬盘的分区加入其中,这样可以实现一种磁盘空 ...
- 配置bond
注意:配置bond要有两个以上的网口 1.配置文件所有目录:/etc/sysconfig/network-scripts 网口配置文件名规则:以ifcfg-开头,然后接着是网口名 例如:eth0的配置 ...
- 数据分析-pandas基础入门(一)
最近在学习python,所以了解了一下Pandas,Pandas是基于NumPy的一个开源Python库,它被广泛用于快速分析数据,以及数据清洗和准备等工作. 首先是安装numpy以及pandas, ...
- JavaWeb基础—项目名的写法
${pageContext.request.contextPath} //jsp中 request.getContextPath() //Servlet中 两者获取到的都是"/项目名称&qu ...
我们设外圆的半径为R 我们可以得到左边(左右其实都一样)那个等腰三角形三角形的斜边长度为R+r,底边为R。又因为的所有圆心连接起来就是一个正多边形,我们知道多边形