본문 바로가기
Beakjoon&프로그래머스/Java

[백준/Java] 1297번 TV 크기

by 현장 2022. 4. 15.

-Code

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int d = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();
        double result = d / Math.sqrt((Math.pow(h, 2) + Math.pow(w, 2)));

        System.out.println((int) (result * h) + " " + (int) (result * w));
    }
}