16600번: Contemporary Art
At the Van Abbemuseum of modern and contemporary art in Eindhoven, we always look to present our muses in the most interesting way possible. Sometimes we have our work cut out for us. Today we are exploring whether we can modify one of our perfectly-square
www.acmicpc.net
문제
At the Van Abbemuseum of modern and contemporary art in Eindhoven, we always look to present our muses in the most interesting way possible. Sometimes we have our work cut out for us.
Today we are exploring whether we can modify one of our perfectly-square picture frames (such as the one shown in Figure C.1) to include an electrical filament. The purpose of this filament is so that the image can set itself alight at some opportune and hilarious moment—for example, in the middle of a sale by auction.
You will be responsible for buying the filament to run around the entire perimeter of the artwork. How many centimetres will you need to obtain?

입력
The input consists of:
- One line with an integer a (1 ≤ a ≤ 1018), the area of the image in square centimetres.
출력
Output the total length of filament needed for the frame, in centimetres. Your answer should have 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);
}
}
'Algorithm > Baekjoon' 카테고리의 다른 글
Baekjoon 20353 Atrium JAVA (0) | 2022.05.04 |
---|---|
Baekjoon 8723 Patyki JAVA (0) | 2022.05.04 |
Baekjoon 15610 Abbey Courtyard JAVA (0) | 2022.05.04 |
Baekjoon 14264 정육각형과 삼각형 JAVA (0) | 2022.05.04 |
Baekjoon 16486 운동장 한 바퀴 JAVA (0) | 2022.05.04 |
댓글