結果

問題 No.419 直角三角形
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-16 03:32:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 1,000 ms
コード長 467 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 71,768 KB
実行使用メモリ 56,120 KB
最終ジャッジ日時 2023-08-17 07:17:52
合計ジャッジ時間 5,681 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
56,028 KB
testcase_01 AC 110 ms
55,772 KB
testcase_02 AC 114 ms
55,880 KB
testcase_03 AC 113 ms
56,000 KB
testcase_04 AC 109 ms
54,548 KB
testcase_05 AC 113 ms
55,912 KB
testcase_06 AC 110 ms
55,912 KB
testcase_07 AC 110 ms
55,920 KB
testcase_08 AC 114 ms
56,120 KB
testcase_09 AC 112 ms
55,752 KB
testcase_10 AC 111 ms
56,104 KB
testcase_11 AC 112 ms
55,956 KB
testcase_12 AC 115 ms
55,776 KB
testcase_13 AC 119 ms
55,788 KB
testcase_14 AC 129 ms
55,484 KB
testcase_15 AC 110 ms
55,520 KB
testcase_16 AC 109 ms
55,548 KB
testcase_17 AC 113 ms
56,060 KB
testcase_18 AC 112 ms
55,464 KB
testcase_19 AC 112 ms
55,796 KB
testcase_20 AC 111 ms
55,744 KB
testcase_21 AC 113 ms
55,792 KB
testcase_22 AC 111 ms
55,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a!=b){
            int l = Math.max(a,b);
            int m = Math.min(a,b);
            double c = Math.sqrt(l*l-m*m);
            System.out.println(c);
        }else{
            double c = Math.sqrt(a*a*2);
            System.out.println(c);
        }
    }
}

0