結果

問題 No.419 直角三角形
ユーザー YamaKasaYamaKasa
提出日時 2018-09-20 00:56:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 444 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 71,716 KB
実行使用メモリ 56,156 KB
最終ジャッジ日時 2023-09-25 10:20:33
合計ジャッジ時間 5,994 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,444 KB
testcase_01 AC 124 ms
56,056 KB
testcase_02 AC 120 ms
55,600 KB
testcase_03 AC 125 ms
55,684 KB
testcase_04 AC 120 ms
55,840 KB
testcase_05 AC 124 ms
56,156 KB
testcase_06 AC 123 ms
55,356 KB
testcase_07 AC 121 ms
55,404 KB
testcase_08 AC 121 ms
55,420 KB
testcase_09 AC 122 ms
55,832 KB
testcase_10 AC 123 ms
56,048 KB
testcase_11 AC 123 ms
55,684 KB
testcase_12 AC 127 ms
55,628 KB
testcase_13 AC 121 ms
55,720 KB
testcase_14 AC 122 ms
56,144 KB
testcase_15 AC 120 ms
56,036 KB
testcase_16 AC 122 ms
54,196 KB
testcase_17 AC 120 ms
53,808 KB
testcase_18 AC 123 ms
55,752 KB
testcase_19 AC 125 ms
55,724 KB
testcase_20 AC 123 ms
55,856 KB
testcase_21 AC 121 ms
55,564 KB
testcase_22 AC 123 ms
55,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();
		scan.close();
		if(a == b) {
			double ans = Math.sqrt(a * a + b * b);
			System.out.println(ans);
		}else {
			long min = Math.min(a, b);
			long max = Math.max(a, b);
			double ans = Math.sqrt(max * max - min * min);
			System.out.println(ans);
		}

	}
}
0