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 ...
随机推荐
- (转)Python学习笔记系列——Python是一种纯粹的语言
此文出自知乎灵剑,原文传送门:https://zhuanlan.zhihu.com/p/23926957. 在摸索适合自己的语言学习方法,看到一篇好文章,转之,侵删. Python的语法范式相当多.知 ...
- 1347: Last Digit (周期函数)
1347: Last Digit Submit Page Summary Time Limit: 1 Sec Memory Limit: 128 Mb Submitted: ...
- iOS Class结构分析
objc_class结构体 类在OC中是objc_class的结构体指针 typedef struct objc_class *Class; 在objc/runtime.h中objc_class结构体 ...
- canvas 绘制双线技巧
楔子 最近一个项目,需要绘制双线的效果,双线效果表示的是轨道(类似铁轨之类的),如下图所示: 负责这块功能开发的小伙,姑且称之为L吧,最开始是通过数学计算的方式来实现这种双线,也就是在原来的路径的基础 ...
- Lucene-----信息检索技术
1 信息检索概述 1.1 传统检索方式的缺点 • 文件检索 操作系统常见的是硬盘文件检索 文档检索:整个文档打开时已经加载到内存了; 缺点:全盘遍历, ...
- golang 实现海明距离 demo
Simhash的算法简单的来说就是,从海量文本中快速搜索和已知simhash相差小于k位的simhash集合,这里每个文本都可以用一个simhash值来代表,一个simhash有64bit,相似的文本 ...
- Go指南 - 笔记
Go指南 - 笔记 标签(空格分隔): Go Go指南 一.基础 1.包 每个Go程序都是由包构成的. 程序从main包开始运行. 包名与导入路径的最后一个元素一致 2.导入 分组导入:使用圆括号组合 ...
- Visual Studio 2010 Express for Windows Phone 永久免费序列号
Visual Studio 2010 Express for Windows Phone 永久免费序列号:YDK44-2WW9W-QV7PM-8P8G8-FTYDF
- 20155325 2017-2018 1 课上测试、课下作业、实验——码云&博客链接汇总 《信息安全系统设计基础》
第二周-课上 码云 https://gitee.com/bestiisjava2017/XinXiAnQuanXiTongSheJiJiChu20155325thl/tree/master/0927 ...
- 20155327 李百乾 Exp4 恶意代码分析
20155327 李百乾 Exp4 恶意代码分析 基础问题回答 (1)如果在工作中怀疑一台主机上有恶意代码,但只是猜想,所以想监控下系统一天天的到底在干些什么.请设计下你想监控的操作有哪些,用什么方法 ...
我们设外圆的半径为R 我们可以得到左边(左右其实都一样)那个等腰三角形三角形的斜边长度为R+r,底边为R。又因为的所有圆心连接起来就是一个正多边形,我们知道多边形