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 ...
随机推荐
- package结构
1.package结构 一个package下常见的文件. 路径有:├── CMakeLists.txt #package的编译规则(必须)├── package.xml #package的描述信息(必 ...
- Usaco2008 Jan
[Usaco2008 Jan] https://www.luogu.org/problemnew/show/P2419 题目描述 N (1 ≤ N ≤ 100) cows, conveniently ...
- 微信公众号开发 [03] 结合UEditor实现图文消息群发功能
0.写在前面的话 如何实现微信平台后台管理中的,图文消息发送功能? 大概的过程如下: 通过类似表单的形式,将文章各部分内容提交到后台,封装成一个实体类,并持久化到数据库中 需要推送的时候,将不同的文章 ...
- 【git3】git+Gogs+webStorm的使用
Gogs:相比gitlab更轻量级,基于golang的搭建自助 Git 服务.使用Gogs轻松搭建可能比GitLab更好用的Git服务平台. 参考资料:http://blog.csdn.net/u01 ...
- ArrayProxy-Emberjs
ember 2.18版本API翻译之Ember.ArrayProxy import ArrayProxy from '@ember/array/proxy'; ArrayProxy(数组代理)包装实现 ...
- A1084
输入:只能输入A-Z(不区分大小写),0-9和下划线: 第一行输入应输入字符串,第二行输入实际输入字符串. 输出:按大写输出缺少的字符,每个字符输出一次. 注意: 1.由于不区分大小写,则需要将小写字 ...
- 20145209刘一阳《JAVA程序设计》第十五周补充测试
第十五周补充测试 1.实验楼Linux中可以通过(ABC)查看用户登录情况. A .who B .who am i C .who mom likes D .who are you 2.在 Linux ...
- PyQt5 笔记(01):嵌套布局
PyQt5 有四种布局:水平(QHBoxLayout).竖直(QVBoxLayout).网格(QGridLayout).表单(QFormLayout)在窗体中单一的布局应该不难,但若是比较复杂的布局, ...
- 10-[CSS]-盒模型:border,padding,margin
1.CSS盒子模型 HTML文档中的每个元素都被描绘成矩形盒子,这些矩形盒子通过一个模型来描述其占用空间,这个模型称为盒子模型. 盒子模型通过四个边界来描述:margin(外边距),border(边框 ...
- jsp编译原理
jsp运行时都要先转换成servlet,使用tomcat时会在tomcat安装目录下的work生成一系列的运行的项目文件夹,文件下面含有.java文件和编译后的.class文件.jsp最终转化为ser ...
我们设外圆的半径为R 我们可以得到左边(左右其实都一样)那个等腰三角形三角形的斜边长度为R+r,底边为R。又因为的所有圆心连接起来就是一个正多边形,我们知道多边形