Codeforces Round #532 (Div. 2)- C(公式计算)
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 nn and the radius of the inner circle rr. NN thinks that, using this information, you can exactly determine the radius of the outer circles RR 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 nn and rr (3≤n≤1003≤n≤100, 1≤r≤1001≤r≤100) — the number of the outer circles and the radius of the inner circle respectively.
Output
Output a single number RR — 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−610−6.
Formally, if your answer is aa and the jury's answer is bb. Your answer is accepted if and only when |a−b|max(1,|b|)≤10−6|a−b|max(1,|b|)≤10−6.
Examples
input
Copy
3 1
output
Copy
6.4641016
input
Copy
6 1
output
Copy
1.0000000
input
Copy
100 100
output
Copy
3.2429391
思路:利用公式计算,考虑一下精度就ok了(可以用acos(-1)来计算pi)
代码:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#define PI 3.141592654
using namespace std;
int main()
{
double n,r;
cin>>n>>r;
printf("%.7f",r*sin(PI/n)/(1-sin(PI/n)));
return 0;
}
Codeforces Round #532 (Div. 2)- C(公式计算)的更多相关文章
- Codeforces Round #532 (Div. 2)
Codeforces Round #532 (Div. 2) A - Roman and Browser #include<bits/stdc++.h> #include<iostr ...
- Codeforces Round #532 (Div. 2) 题解
Codeforces Round #532 (Div. 2) 题目总链接:https://codeforces.com/contest/1100 A. Roman and Browser 题意: 给出 ...
- Codeforces Round #532(Div. 2) C.NN and the Optical IIIusion
链接:https://codeforces.com/contest/1100/problem/C 题意: 一个圆球外面由其他圆球包裹,两两相连. 给出n,r. n为外面圆球数量,r为内部圆球半径. 求 ...
- Codeforces Round #532 (Div. 2) F 线性基(新坑) + 贪心 + 离线处理
https://codeforces.com/contest/1100/problem/F 题意 一个有n个数组c[],q次询问,每次询问一个区间的子集最大异或和 题解 单问区间子集最大异或和,线性基 ...
- Codeforces Round #532 (Div. 2):F. Ivan and Burgers(贪心+异或基)
F. Ivan and Burgers 题目链接:https://codeforces.com/contest/1100/problem/F 题意: 给出n个数,然后有多个询问,每次回答询问所给出的区 ...
- Codeforces Round #532 (Div. 2)- B(思维)
Arkady coordinates rounds on some not really famous competitive programming platform. Each round fea ...
- Codeforces Round #532(Div. 2) B.Build a Contest
链接:https://codeforces.com/contest/1100/problem/B 题意: 给n,m. 给m个数,每个数代表一个等级,没给一个将其添加到题目池中,当题目池中有难度(1-n ...
- Codeforces Round #532(Div. 2) A.Roman and Browser
链接:https://codeforces.com/contest/1100/problem/A 题意: 给定n,k. 给定一串由正负1组成的数. 任选b,c = b + i*k(i为任意整数).将c ...
- Codeforces Round #532 (Div. 2) E. Andrew and Taxi(二分+拓扑排序)
题目链接:https://codeforces.com/contest/1100/problem/E 题意:给出 n 个点 m 条边的有向图,要翻转一些边,使得有向图中不存在环,问翻转的边中最大权值最 ...
随机推荐
- ie6-ie8不支持opacity,rgba解决方法
半透明部分设置样式:opacity:0.7在ie9/ie10/ff/chrome/opera/safari显示正常. 但是这样在ie6-ie8中是不支持的,需要加上下面这句话: filter: pro ...
- python之特殊方法
特殊方法的定义: 1.定义在某些class当中 2.不需要直接调用 3.Python的某些函数或者是操作符会调用相应的特殊方法 特殊方法很多,我们只需要编写用到的特殊方法,以及有关联性的特殊方法. — ...
- [Python Study Notes]饼状图绘制
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ...
- adb pull 和 adb push
1. 操作单个文件 通过adb push,则可将文件添加到SD卡中.如果想在push的时候修改文件名称的话,只需要修改push的第二个参数改成完整路径(目录+文件名),如/sdcard/test-0. ...
- 杭电acm 1038题
本题比较简单,但是需要掌握几个小技巧,先上代码 /************************************* 杭电ACM 1038题,已AC ********************* ...
- p4068 [SDOI2016]数字配对
传送门 分析 我们考虑对所有a[i]质因数分解,然后记cnt[i]为a[i]是由几个质数相乘得到的 然后我们建一个二分图,左面为所有cnt[i]为奇数的点,右面是为偶数的点 我们从源点向左面点连容量b ...
- SQL GO语句
GO是批处理的标志,是一条或多条SQL语句的集合,SQL Server将批处理语句编译成一个可执行单元,此单元称为执行计划. GO语句把程序分成一个个代码块,即使一个代码块执行错误,它后面的代码块任然 ...
- Cyber-Ark spring mvc @autowired
我们帮助中国平安改进他们重要系统的特权帐号密码管理,提供给他们一个“统一的,集中的,安全的”特权帐号密码管理解决方案.完全满足平安信息安全部对“特权帐号生命周期管理”的理解和需求,而且关键组件的高可用 ...
- samba多用户
注意的点 1:安装 服务器 yum install -y samba* 客户端 yum install -y samba-client cifs-utils 服务器端和客户端网络能ping通 2 ...
- UWP&WP8.1 基础控件—Button
Button作为最常用的控件,没有特别难的用法,是一个非常简单,可以很快就掌握的控件. Button 基础用法: 同样,在UWP项目中,可以从工具箱中拖拽到面板中进行使用.也可以使用XAML语法进行编 ...