結果

問題 No.419 直角三角形
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-12-18 14:14:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 1,000 ms
コード長 399 bytes
コンパイル時間 3,916 ms
コンパイル使用メモリ 71,580 KB
実行使用メモリ 56,152 KB
最終ジャッジ日時 2023-08-21 00:50:50
合計ジャッジ時間 7,101 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,588 KB
testcase_01 AC 122 ms
56,000 KB
testcase_02 AC 123 ms
55,952 KB
testcase_03 AC 122 ms
55,928 KB
testcase_04 AC 121 ms
55,836 KB
testcase_05 AC 124 ms
55,900 KB
testcase_06 AC 121 ms
56,120 KB
testcase_07 AC 122 ms
55,872 KB
testcase_08 AC 123 ms
55,728 KB
testcase_09 AC 125 ms
55,768 KB
testcase_10 AC 125 ms
55,748 KB
testcase_11 AC 122 ms
55,776 KB
testcase_12 AC 122 ms
55,624 KB
testcase_13 AC 125 ms
53,576 KB
testcase_14 AC 125 ms
56,112 KB
testcase_15 AC 122 ms
55,796 KB
testcase_16 AC 124 ms
55,836 KB
testcase_17 AC 123 ms
55,780 KB
testcase_18 AC 122 ms
55,648 KB
testcase_19 AC 121 ms
55,452 KB
testcase_20 AC 121 ms
56,152 KB
testcase_21 AC 122 ms
55,624 KB
testcase_22 AC 122 ms
55,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class No_419 {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	sc.close();
	if(a == b){
		double c = a * Math.sqrt(2);
		System.out.println(c);
	}else{
	double abs = Math.abs(Math.pow(a, 2) - Math.pow(b, 2));
	double c = Math.sqrt(abs);
	System.out.println(c);
	}
}
}
0