code forces 630 P. Area of a Star

P. Area of a Star
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

It was decided in IT City to distinguish successes of local IT companies by awards in the form of stars covered with gold from one side. To order the stars it is necessary to estimate order cost that depends on the area of gold-plating. Write a program that can calculate the area of a star.

A "star" figure having n ≥ 5 corners where n is a prime number is constructed the following way. On the circle of radius r n points are selected so that the distances between the adjacent ones are equal. Then every point is connected by a segment with two maximally distant points. All areas bounded by the segments parts are the figure parts.

Input

The only line of the input contains two integers n (5 ≤ n < 109n is prime) and r (1 ≤ r ≤ 109) — the number of the star corners and the radius of the circumcircle correspondingly.

Output

Output one number — the star area. The relative error of your answer should not be greater than 10 - 7.

Examples
input
7 10
output

108.395919545675


三角函数


求角,求边,求面积!


AC code

#include<stdio.h>
#include<math.h>
#define PI acos(-1.0)
int main()
{
	double  A,B,C;
	double a,b,c,s;
	int n,r;
	while(scanf("%d%d",&n,&r)!=EOF)
	{
		A=PI*1.0/(n);
		B=PI*1.0/(2*n);
		C=PI-A-B;
		a=sin(A)*(r/sin(C));
		s=0.5*a*r*(sin(B))*2*n;
		printf("%.7lf\n",s);
		
	}
}





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The fundamentals of physics refer to the basic principles, theories, and laws that govern the behavior of matter and energy in the universe. These fundamental concepts help us understand and explain the physical phenomena around us, from the motion of objects to the behavior of subatomic particles. Some of the key concepts in physics include: 1. Mechanics: Mechanics is the branch of physics that deals with the study of motion, forces, and energy. It includes classical mechanics, which describes the motion of macroscopic objects and their interactions with each other, and quantum mechanics, which describes the behavior of subatomic particles. 2. Thermodynamics: Thermodynamics is the branch of physics that deals with the study of heat and its relationship to other forms of energy. It includes the laws of thermodynamics, which describe the behavior of energy in closed systems. 3. Electricity and Magnetism: Electricity and magnetism are closely related phenomena that are studied in physics. They are governed by Maxwell's equations, which describe the behavior of electric and magnetic fields and their interactions with charged particles. 4. Waves: Waves are a fundamental concept in physics, describing the behavior of energy as it travels through space. This includes electromagnetic waves, such as light and radio waves, as well as mechanical waves, such as sound waves. 5. Relativity: Relativity is a theory developed by Albert Einstein that describes the behavior of objects in motion and the relationship between space and time. It includes special relativity, which deals with objects moving at constant speeds, and general relativity, which describes the behavior of objects in the presence of gravity. These are just a few of the key concepts in physics, and there are many more that are studied in various fields of physics, such as astrophysics, particle physics, and quantum mechanics. Understanding these fundamental concepts is essential for anyone interested in studying physics or understanding the natural world around us.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值