結果

問題 No.419 直角三角形
ユーザー htensaihtensai
提出日時 2019-11-19 23:45:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 392 bytes
コンパイル時間 2,330 ms
コンパイル使用メモリ 75,072 KB
実行使用メモリ 54,484 KB
最終ジャッジ日時 2024-04-15 03:51:38
合計ジャッジ時間 5,629 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
53,916 KB
testcase_01 AC 120 ms
54,484 KB
testcase_02 AC 107 ms
52,776 KB
testcase_03 AC 104 ms
53,064 KB
testcase_04 AC 121 ms
54,104 KB
testcase_05 AC 110 ms
53,012 KB
testcase_06 AC 115 ms
53,792 KB
testcase_07 AC 106 ms
52,996 KB
testcase_08 AC 117 ms
54,244 KB
testcase_09 AC 107 ms
53,072 KB
testcase_10 AC 115 ms
54,056 KB
testcase_11 AC 119 ms
54,216 KB
testcase_12 AC 120 ms
54,228 KB
testcase_13 AC 118 ms
54,172 KB
testcase_14 AC 117 ms
54,240 KB
testcase_15 AC 112 ms
53,612 KB
testcase_16 AC 117 ms
54,144 KB
testcase_17 AC 124 ms
54,152 KB
testcase_18 AC 123 ms
54,436 KB
testcase_19 AC 121 ms
54,224 KB
testcase_20 AC 121 ms
54,140 KB
testcase_21 AC 118 ms
54,112 KB
testcase_22 AC 127 ms
54,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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