본문 바로가기
Algorithm/Baekjoon

Baekjoon 20352 Circus JAVA

by Hunveloper 2022. 5. 5.
728x90
 

20352번: Circus

In the modern world, the spotlight has shifted entirely from live shows to televised recordings.  Well, not entirely... One small troupe of indomitable entertainers still holds out and puts on regular circus performances. The shows are extremely popular.

www.acmicpc.net

문제

In the modern world, the spotlight has shifted entirely from live shows to televised recordings.  Well, not entirely... One small troupe of indomitable entertainers still holds out and puts on regular circus performances.

The shows are extremely popular. Streaming media services nearby have caught on and, of course tried to cash in by opening their own circuses. However, they still need good acts to pull in crowds---and the natural solution has been to sneak into the big top to poach ideas and talent.

This can not go on. The ringmaster, inspired by his distant cousins from a small village in Armorica, proposes to build a circular wall around the big top to prevent unauthorised entry.

Figure C.1: Diagram of the indomitable circus, fencing, and the surrounding encampments of Flixium, Fundibulum, Maximillian, and Hulum. This image was adapted from an   illustration   of the Goseck circle by Kenny Arne Lang Antonsen.

 

To build this wall, enough fencing will be needed to cover a length equal to the perimeter of the circular tent. How many metres will you need to obtain?

입력

The input consists of:

  • One line with an integer a (1≤a≤10^18), the area of the circus tent in square metres.
 
출력

Output the total length of fence needed for the circus palisade wall, in metres. Your answer should have an absolute or relative error of at most 10^-6.

풀이

서커스 텐트의 넓이를 입력받고 이것을 root를 씌우면 R의 넓이가 나온다.

이때 입력받은 넓이는 이미 Pi*r^2 이기에 R을 구해야한다.

입력받은 값 : PI * R * R = x    =>  R * R = x/PI      =>      R = root(x/PI)

구해야하는 값 : 2 * PI * R       => 2 * PI * root(x/PI)  => 2 * root(pi) * root(x) 

코드
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(2*Math.pow(sc.nextDouble()*Math.PI, 0.5));
	}
}

 

728x90
728x90

'Algorithm > Baekjoon' 카테고리의 다른 글

Baekjoon 20215 Cutting Corners JAVA  (0) 2022.05.05
Baekjoon 21335 Another Eruption JAVA  (0) 2022.05.05
Baekjoon 1051 숫자 정사각형 JAVA  (0) 2022.05.04
Baekjoon 20353 Atrium JAVA  (0) 2022.05.04
Baekjoon 8723 Patyki JAVA  (0) 2022.05.04

댓글