```
백준 20352번 Circus JAVA 구현해보기
```

이번 글을 통해 배워갈 내용
- 백준 20352번 풀이
https://www.acmicpc.net/problem/20352
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
백준 20352번 Circus는
난이도 브론즈 등급의 문제로서
원형 텐트의 넓이인
0부터 10^18까지의 수중 하나인 A 가 주어질 때
10^-6 정밀도로 텐트 둘레를 구해주면 됩니다.
30분 정도 위에 링크를 방문하셔서 풀어보시고
안 풀리시는 경우에만 아래 해답을 봐주시면 감사하겠습니다.
A = pi * r^2
P = 2 * pi * r
이기 때문에
P = 2 (A * pi)^0.5입니다.
이를 가지고 공식을 세워서 구해주면 됩니다.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.MathContext;
public class Main {
static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException {
BigDecimal tentArea = new BigDecimal(br.readLine());
double tentPerimeter = tentArea
.multiply(BigDecimal.valueOf(Math.PI))
.multiply(BigDecimal.valueOf(4))
.sqrt(new MathContext(12)).doubleValue();
System.out.println(tentPerimeter);
}
}
읽어주셔서 감사합니다
무엇인가 얻어가셨기를 바라며
오늘도 즐거운 코딩 하시길 바랍니다 ~ :)
728x90
'Java > Java 알고리즘' 카테고리의 다른 글
| 백준 18247번 티켓 예매 JAVA 구현해보기 (0) | 2022.02.12 |
|---|---|
| 백준 20353번 Atrium JAVA 구현해보기 (0) | 2022.02.11 |
| 백준 2857번 JAVA 구현해보기 (0) | 2022.02.10 |
| 백준 21185번 Some Sum JAVA 구현해보기 (1) | 2022.02.10 |
| 백준 21335번 또 다른 분출 JAVA 구현해보기 (2) | 2022.02.10 |