Java/Java 알고리즘
백준 20353번 Atrium JAVA 구현해보기
kimc
2022. 2. 11. 22:13
```
백준 20353번 Atrium JAVA 구현해보기
```

이번 글을 통해 배워갈 내용
- 백준 20353번 풀이
https://www.acmicpc.net/problem/20353
20353번: Atrium
The atrium of a traditional Roman dormus, much like the atria of today, is a perfectly square room designed for residents and guests to congregate in and to enjoy the sunlight streaming in from above. Or, in the case of Britannia, the rain streaming in fro
www.acmicpc.net
백준 20353번 Atrium은
난이도 브론즈 등급의 문제로서
1부터 10^18 사이의 값인
정사각형의 넓이 A 가 주어질 때
최소 소수점 6자리 정확도 이상을 가진 둘레 P를 구해주면 되는 문제입니다.
30분 정도 위에 링크를 방문하셔서 풀어보시고
안 풀리시는 경우에만 아래 해답을 봐주시면 감사하겠습니다.
A = side * side
P = 4 * side
이기 때문에
P = (16*A)^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 atriumArea = new BigDecimal(br.readLine());
double atriumPerimeter = atriumArea
.multiply(BigDecimal.valueOf(16))
.sqrt(new MathContext(12)).doubleValue();
System.out.println(atriumPerimeter);
}
}
읽어주셔서 감사합니다
무엇인가 얻어가셨기를 바라며
오늘도 즐거운 코딩 하시길 바랍니다 ~ :)
728x90