Dev.baelanche

[백준 3053] 택시 기하학 본문

Data Structure & Algorithm/PS - JAVA

[백준 3053] 택시 기하학

baelanche 2019. 4. 10. 20:08
반응형

 

 

문제 하단에 달려있는 위키 링크를 참조하여 풀었다.

 

유클리드 기하학 원 넓이는 흔히 알고있는 πr2 이고

택시 기하학 원 넓이는 마름모 모양으로, (2r)^2/2 이다.

 

 

 

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        DecimalFormat df = new DecimalFormat("0.000000");
        
        int r = sc.nextInt();
        
        double uclid = r*r*Math.PI;
        double taxi = (2*r)*(2*r)/2;
        System.out.println(df.format(uclid));
        System.out.println(df.format(taxi));
        sc.close();
    }
}
반응형

'Data Structure & Algorithm > PS - JAVA' 카테고리의 다른 글

[백준 10539] 수빈이와 수열  (0) 2019.04.11
[백준 5567] 결혼식  (0) 2019.04.11
[백준 2798] 블랙잭  (0) 2019.04.10
[백준 8979] 올림픽  (0) 2019.04.10
[백준 2468] 안전 영역  (0) 2019.04.10
Comments