알고리즘 풀이/백준

[백준][Java] 3053번 택시 기하학

배게 2018. 5. 10. 19:14
728x90

뭐 이런 쉬운 문제가 30퍼띠기인가

생각해보는 문제였습니다.


유클리드 원은 초딩 때 배운 파이알제곱 해주고

택시 원은 대각선의 값이 2R인 정사각형의

넓이를 구해주시면 됩니다.



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args)  {
		
		Scanner sc = new Scanner(System.in);
		
		int R = sc.nextInt();
		
		String res1 = String.format("%.6f", Math.PI * R * R) ;
		String res2 = String.format("%.6f", (double)2 * R * R) ;
		
		System.out.println(res1);
		System.out.println(res2);
		 
	}
	
}