結果

問題 No.419 直角三角形
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-03-06 14:52:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 368 bytes
コンパイル時間 4,301 ms
コンパイル使用メモリ 73,708 KB
実行使用メモリ 57,504 KB
最終ジャッジ日時 2023-10-19 02:49:48
合計ジャッジ時間 7,529 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,352 KB
testcase_01 AC 131 ms
57,356 KB
testcase_02 AC 131 ms
57,152 KB
testcase_03 AC 134 ms
57,336 KB
testcase_04 AC 132 ms
57,388 KB
testcase_05 AC 131 ms
57,352 KB
testcase_06 AC 135 ms
57,424 KB
testcase_07 AC 136 ms
55,396 KB
testcase_08 AC 135 ms
57,380 KB
testcase_09 AC 136 ms
57,416 KB
testcase_10 AC 133 ms
57,504 KB
testcase_11 AC 132 ms
57,376 KB
testcase_12 AC 132 ms
57,380 KB
testcase_13 AC 134 ms
57,108 KB
testcase_14 AC 135 ms
57,408 KB
testcase_15 AC 133 ms
57,348 KB
testcase_16 AC 136 ms
57,396 KB
testcase_17 AC 133 ms
57,460 KB
testcase_18 AC 133 ms
57,392 KB
testcase_19 AC 131 ms
57,424 KB
testcase_20 AC 134 ms
57,452 KB
testcase_21 AC 132 ms
57,464 KB
testcase_22 AC 135 ms
57,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		double ans;
		if (a==b) {ans = Math.sqrt(a*a+b*b);}
		else if (a>b) {ans = Math.sqrt(a*a-b*b);}
		else {ans = Math.sqrt(b*b-a*a);}
		out.println(ans);
	}
}
0