码迷,mamicode.com
首页 > 其他好文 > 详细

Gym 100733 A

时间:2015-09-11 23:19:37      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

题目:

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.

题目大意:(分析)水题,可刚开始没看出来。。

    给你一个n角星型的图案,已知外顶点都在一个圆上(R),内顶点也在一个圆上(r),如上图4角星中的可见的三角形,就是求这2n个三角形的面积和。。

   用到了s=1/2(a*b*sinC),注意,sin()三角函数用的是弧度制。

技术分享
 1 #include<iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 #include<cmath>
 5 using namespace std;
 6 const double pi=acos(-1.0);
 7 const double eps=1e-6;
 8 int main()
 9 {
10     double n,R,r;
11     cin>>n>>R>>r;
12     double ans;
13     ans=n*(R*r*sin((pi/n)));
14     printf("%.10lf\n",ans);
15     return 0;
16 }
View Code

 

Gym 100733 A

标签:

原文地址:http://www.cnblogs.com/forwin/p/4802294.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!