2016 Java Chapter 4 (Week 04)

From: 2016-09-01 00:00:00 To: 2016-10-19 00:00:00 Now: 2024-05-02 15:24:00 Status: Public

C - 기하: 정다각형의 넓이

Time Limit: 1s Memory Limit: 128MB

Submissions: 1657 Solved: 565
Description

정다각형은 변의 길이가 모두 동일한 다각형입니다. 변의 개수 n과 변의 길이 s가 주어졌을때 정다각형의 넓이를 계산하는 프로그램을 작성하세요. 정다각형의 넓이를 계산하는 공식은 다음과 같습니다.

A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon is

Here, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area.

 

Input

* Line 1 : 정수 n (3~100)

* Line 2 : 실수 s (0~100)

 

Output

* Line 1 : area의 넓이 (소수점 둘째자리까지만 출력, 예: 11.263의 경우 11.26로 출력하고 11.00의 경우 11.00로 출력, -11.256의 경우 -11.25로 출력)

 

Sample Input
5
6.5
Sample Output
72.69
Source

JAVA2015 PE4.5