結果

問題 No.419 直角三角形
ユーザー Mcpu3Mcpu3
提出日時 2018-09-20 07:37:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 381 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 71,968 KB
実行使用メモリ 56,724 KB
最終ジャッジ日時 2023-09-25 10:25:06
合計ジャッジ時間 6,279 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
56,664 KB
testcase_01 AC 132 ms
56,136 KB
testcase_02 AC 132 ms
56,520 KB
testcase_03 AC 134 ms
53,708 KB
testcase_04 AC 133 ms
56,344 KB
testcase_05 AC 134 ms
56,212 KB
testcase_06 AC 133 ms
56,420 KB
testcase_07 AC 135 ms
56,108 KB
testcase_08 AC 132 ms
56,192 KB
testcase_09 AC 135 ms
56,576 KB
testcase_10 AC 134 ms
55,884 KB
testcase_11 AC 133 ms
56,504 KB
testcase_12 AC 133 ms
55,960 KB
testcase_13 AC 135 ms
56,012 KB
testcase_14 AC 130 ms
56,724 KB
testcase_15 AC 130 ms
54,348 KB
testcase_16 AC 128 ms
56,048 KB
testcase_17 AC 130 ms
56,128 KB
testcase_18 AC 129 ms
56,020 KB
testcase_19 AC 138 ms
56,480 KB
testcase_20 AC 136 ms
56,160 KB
testcase_21 AC 135 ms
56,032 KB
testcase_22 AC 134 ms
56,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        double a=sc.nextDouble(),b=sc.nextDouble(),c,d;
        sc.close();
        c=a*a-b*b;
        d=b*b-a*a;
        System.out.print(a!=b?Math.sqrt(c)<Math.sqrt(d)?Math.sqrt(Math.abs(c)):Math.sqrt(Math.abs(d)):Math.sqrt(a*b+a*b));
    }
}
0