题目:
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 }