Codeforces Gym 100733A Shitália 计算几何
2015-08-22 18:37
441 查看
[b]Shitália[/b]
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88994#problem/A
Description
After suddenly becoming a billionaire, Shi adopted YOLO as his motto and decided to buy a small european island, which he named Shitalia. Many people decided to move to Shitalia to run away from the economic crisis, and then created the Shitalian mafia, led by Dom Shi.
The Shitalian economy is based on smuggling spoiled cheese, but, as you can imagine, there aren't many people interested in spoiled cheese. Therefore, Shi decided to earn money with land rental.
Shitalia is a star-shaped island. Shi is very picky, so he chose a Shi-regular n-star. An n-star is Shi-regular if there are n outer points andn inner points alternated. The outer points must lay on a circle with radius R and the inner points must lay on a circle with radius r and all the points must be equally spaced.
Print the area of the Shitalia.
Shi-regular 6-star and 4-star.
Input
The first line contains three integers 3 ≤ n ≤ 20, 1 ≤ R ≤ 106 and 1 ≤ r ≤ R, indicating the number of points of Shitalia, the radius of the outer circle and the radius of the inner circle.
Output
Print a single real number - the answer to the problem with absolute or relative error of at most 10 - 6.
Sample Input
3 2 1
Sample Output
5.1961524227
HINT
题意
给你一个等n角形,然后求面积
题解:
数学题,一眼题,求三角形面积就好了……
代码:
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88994#problem/A
Description
After suddenly becoming a billionaire, Shi adopted YOLO as his motto and decided to buy a small european island, which he named Shitalia. Many people decided to move to Shitalia to run away from the economic crisis, and then created the Shitalian mafia, led by Dom Shi.
The Shitalian economy is based on smuggling spoiled cheese, but, as you can imagine, there aren't many people interested in spoiled cheese. Therefore, Shi decided to earn money with land rental.
Shitalia is a star-shaped island. Shi is very picky, so he chose a Shi-regular n-star. An n-star is Shi-regular if there are n outer points andn inner points alternated. The outer points must lay on a circle with radius R and the inner points must lay on a circle with radius r and all the points must be equally spaced.
Print the area of the Shitalia.
Shi-regular 6-star and 4-star.
Input
The first line contains three integers 3 ≤ n ≤ 20, 1 ≤ R ≤ 106 and 1 ≤ r ≤ R, indicating the number of points of Shitalia, the radius of the outer circle and the radius of the inner circle.
Output
Print a single real number - the answer to the problem with absolute or relative error of at most 10 - 6.
Sample Input
3 2 1
Sample Output
5.1961524227
HINT
题意
给你一个等n角形,然后求面积
题解:
数学题,一眼题,求三角形面积就好了……
代码:
//qscqesze #include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <set> #include <vector> #include <sstream> #include <queue> #include <typeinfo> #include <fstream> #include <map> #include <stack> typedef long long ll; using namespace std; //freopen("D.in","r",stdin); //freopen("D.out","w",stdout); #define sspeed ios_base::sync_with_stdio(0);cin.tie(0) #define maxn 200051 #define mod 10007 #define eps 1e-9 int Num; //const int inf=0x7fffffff; //нчоч╢С const int inf=0x3f3f3f3f; inline ll read() { ll x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } //************************************************************************************** #define pi 3.1415926535898 int main() { double n,R,r; cin>>n>>R>>r; printf("%.10lf\n",sin(pi/n)*r*R*n); }
相关文章推荐
- 顺序查找
- shader三种变量类型(uniform,attribute和varying)
- 分别利用JS和JQ获取数组索引值index的办法
- 黑马程序员_集合总结
- IOS typedef 函数指针的用法
- C# 跨线程调用控件
- iOS开发:TabBar的图片不显示,只显示灰色的正方形
- 九度oj 1128
- 最近需要学习的内容
- DLX (Dancing Links/舞蹈链)算法——求解精确覆盖问题
- 如 Git 般思考
- Java 1.8 HashMap实现(译注)
- C++ Primer 学习笔记与思考_8 指针和const的那些麻烦
- 安卓-屏幕适配方式
- Codeforces Gym 100733J Summer Wars 线段树,区间更新,区间求最大值,离散化,区间求并
- 矩阵二分幂求Fib(非结构体版)
- Qt 编码问题QTextCodec
- 谈论quick-cocos2d-x和cocos2d-x lua了解差异
- 供应链相关的书和博客
- 如何使用Reveal来查看iPhone手机上任意的APP ui架构