結果

問題 No.419 直角三角形
ユーザー GoryudyumaGoryudyuma
提出日時 2017-05-12 21:55:05
言語 Java19
(openjdk 21)
結果
AC  
実行時間 129 ms / 1,000 ms
コード長 537 bytes
コンパイル時間 1,979 ms
コンパイル使用メモリ 71,840 KB
実行使用メモリ 56,700 KB
最終ジャッジ日時 2023-10-13 13:59:38
合計ジャッジ時間 5,881 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,516 KB
testcase_01 AC 129 ms
56,496 KB
testcase_02 AC 125 ms
55,988 KB
testcase_03 AC 128 ms
56,088 KB
testcase_04 AC 120 ms
56,096 KB
testcase_05 AC 120 ms
55,764 KB
testcase_06 AC 120 ms
56,544 KB
testcase_07 AC 119 ms
56,084 KB
testcase_08 AC 126 ms
56,508 KB
testcase_09 AC 127 ms
56,356 KB
testcase_10 AC 124 ms
56,696 KB
testcase_11 AC 120 ms
55,724 KB
testcase_12 AC 120 ms
56,176 KB
testcase_13 AC 119 ms
56,544 KB
testcase_14 AC 121 ms
56,136 KB
testcase_15 AC 120 ms
56,204 KB
testcase_16 AC 117 ms
56,188 KB
testcase_17 AC 123 ms
56,700 KB
testcase_18 AC 124 ms
55,944 KB
testcase_19 AC 119 ms
56,336 KB
testcase_20 AC 118 ms
56,256 KB
testcase_21 AC 123 ms
56,076 KB
testcase_22 AC 118 ms
56,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
        public static void main(String[] args){
                try(Scanner sc = new Scanner(System.in)){
                        double a = sc.nextDouble(), b = sc.nextDouble();
                        if(a != b){
                                System.out.printf("%.10f\n", Math.sqrt(Math.abs(a * a - b * b)));
                        }else{
                                System.out.printf("%.10f\n", Math.sqrt(Math.abs(a * a + b * b)));
                        }
                }
        }
}
0