結果

問題 No.419 直角三角形
ユーザー kohaku_kohaku
提出日時 2016-11-16 03:32:33
言語 Java
(openjdk 23)
結果
AC  
実行時間 120 ms / 1,000 ms
コード長 467 bytes
コンパイル時間 4,795 ms
コンパイル使用メモリ 83,448 KB
実行使用メモリ 54,124 KB
最終ジャッジ日時 2024-11-26 02:05:50
合計ジャッジ時間 7,820 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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