結果

問題 No.419 直角三角形
ユーザー tentententen
提出日時 2020-09-11 17:13:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 1,000 ms
コード長 444 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 72,192 KB
実行使用メモリ 56,436 KB
最終ジャッジ日時 2023-08-27 01:04:28
合計ジャッジ時間 5,811 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,768 KB
testcase_01 AC 115 ms
55,904 KB
testcase_02 AC 117 ms
56,040 KB
testcase_03 AC 117 ms
55,840 KB
testcase_04 AC 114 ms
56,332 KB
testcase_05 AC 117 ms
55,732 KB
testcase_06 AC 114 ms
56,040 KB
testcase_07 AC 116 ms
55,820 KB
testcase_08 AC 113 ms
56,436 KB
testcase_09 AC 116 ms
55,796 KB
testcase_10 AC 114 ms
55,816 KB
testcase_11 AC 114 ms
55,844 KB
testcase_12 AC 114 ms
56,080 KB
testcase_13 AC 117 ms
55,988 KB
testcase_14 AC 119 ms
56,108 KB
testcase_15 AC 114 ms
55,868 KB
testcase_16 AC 116 ms
54,068 KB
testcase_17 AC 116 ms
55,972 KB
testcase_18 AC 115 ms
56,048 KB
testcase_19 AC 116 ms
56,100 KB
testcase_20 AC 116 ms
56,252 KB
testcase_21 AC 115 ms
55,588 KB
testcase_22 AC 114 ms
55,992 KB
権限があれば一括ダウンロードができます

ソースコード

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