結果

問題 No.419 直角三角形
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-29 19:53:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 1,000 ms
コード長 407 bytes
コンパイル時間 2,297 ms
コンパイル使用メモリ 75,376 KB
実行使用メモリ 41,416 KB
最終ジャッジ日時 2024-04-29 23:12:51
合計ジャッジ時間 6,655 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
41,160 KB
testcase_01 AC 132 ms
41,216 KB
testcase_02 AC 121 ms
40,220 KB
testcase_03 AC 131 ms
41,320 KB
testcase_04 AC 131 ms
41,004 KB
testcase_05 AC 135 ms
41,028 KB
testcase_06 AC 137 ms
40,900 KB
testcase_07 AC 135 ms
41,340 KB
testcase_08 AC 139 ms
41,304 KB
testcase_09 AC 134 ms
41,000 KB
testcase_10 AC 131 ms
41,236 KB
testcase_11 AC 133 ms
41,312 KB
testcase_12 AC 133 ms
40,968 KB
testcase_13 AC 133 ms
41,064 KB
testcase_14 AC 132 ms
41,088 KB
testcase_15 AC 142 ms
41,416 KB
testcase_16 AC 141 ms
41,104 KB
testcase_17 AC 133 ms
41,232 KB
testcase_18 AC 137 ms
41,192 KB
testcase_19 AC 133 ms
40,924 KB
testcase_20 AC 134 ms
41,132 KB
testcase_21 AC 132 ms
41,160 KB
testcase_22 AC 134 ms
41,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a=scanner.nextInt();
		int b=scanner.nextInt();
		if(a==b) {
			System.out.println(Math.sqrt(Math.pow(a, 2)*2));
			return;
		}
		double c=Math.pow(Math.max(a, b),2)-Math.pow(Math.min(a, b), 2);
		System.out.println(Math.sqrt(c));
	}
}
0