結果

問題 No.419 直角三角形
ユーザー takeya_okinotakeya_okino
提出日時 2017-10-27 21:12:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 387 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 71,392 KB
実行使用メモリ 56,476 KB
最終ジャッジ日時 2023-08-14 03:24:55
合計ジャッジ時間 6,179 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
56,408 KB
testcase_01 AC 134 ms
56,256 KB
testcase_02 AC 133 ms
56,104 KB
testcase_03 AC 134 ms
56,268 KB
testcase_04 AC 133 ms
55,860 KB
testcase_05 AC 134 ms
56,476 KB
testcase_06 AC 137 ms
55,704 KB
testcase_07 AC 136 ms
56,180 KB
testcase_08 AC 137 ms
55,964 KB
testcase_09 AC 134 ms
55,612 KB
testcase_10 AC 134 ms
56,204 KB
testcase_11 AC 134 ms
56,132 KB
testcase_12 AC 135 ms
55,968 KB
testcase_13 AC 135 ms
56,412 KB
testcase_14 AC 136 ms
56,204 KB
testcase_15 AC 135 ms
56,024 KB
testcase_16 AC 136 ms
55,684 KB
testcase_17 AC 134 ms
56,088 KB
testcase_18 AC 136 ms
56,240 KB
testcase_19 AC 136 ms
56,296 KB
testcase_20 AC 135 ms
55,920 KB
testcase_21 AC 135 ms
56,048 KB
testcase_22 AC 135 ms
56,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double m = Math.min(a, b);
    double M = Math.max(a, b);
    double ans = (double)Math.sqrt(M * M - m * m);
    if(m == M) ans = (double)Math.sqrt(2 * m * m);
    System.out.println(ans);
  }
}
0