본문 바로가기
Algorithm/Baekjoon

Baekjoon 20353 Atrium JAVA

by Hunveloper 2022. 5. 4.
728x90
 

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

문제

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 from above.

A major problem with traditional Roman architecture, particularly in modern times, is the absence of any kind of effective walls between rooms. You have arrived in Italy and now you are going to helpfully rebuild the walls on behalf of the authorities, starting with the atrium of a particularly derelict building you found.

What length of prefabricated wall section must you bring with you to fully enclose the atrium of the building?

입력

The input consists of a single integer a (1 ≤ a ≤ 1018), the area in square meters of the Atrium.

출력

Output the total length of walling needed for the atrium, in metres. The length should be accurate to an absolute or relative error of at most 10^−6.

풀이

사각형의 넓이를 입력받고, 제곱근을 취해 한 면의 길이를 구한다.

그리고 *4를 하여 전체 둘레의 길이를 구함

코드
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(Math.sqrt(sc.nextLong())*4);
	}
}

 

728x90
728x90

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

Baekjoon 20352 Circus JAVA  (0) 2022.05.05
Baekjoon 1051 숫자 정사각형 JAVA  (0) 2022.05.04
Baekjoon 8723 Patyki JAVA  (0) 2022.05.04
Baekjoon 16600 Contemporary Art JAVA  (0) 2022.05.04
Baekjoon 15610 Abbey Courtyard JAVA  (0) 2022.05.04

댓글