結果

問題 No.419 直角三角形
ユーザー tenten
提出日時 2020-09-11 17:13:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 169 ms / 1,000 ms
コード長 444 bytes
コンパイル時間 2,860 ms
コンパイル使用メモリ 74,700 KB
実行使用メモリ 41,316 KB
最終ジャッジ日時 2024-12-26 05:27:08
合計ジャッジ時間 7,448 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int a = sc.nextInt();
    	int b = sc.nextInt();
    	int max = Math.max(a, b);
    	int min = Math.min(a, b);
    	if (max == min) {
    	    System.out.println(Math.sqrt(Math.pow(max, 2) + Math.pow(min, 2)));
    	} else {
    	    System.out.println(Math.sqrt(Math.pow(max, 2) - Math.pow(min, 2)));
    	}
	}
}
0