結果

問題 No.419 直角三角形
ユーザー hhgfhn1
提出日時 2018-10-29 19:53:28
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 1,000 ms
コード長 407 bytes
コンパイル時間 2,296 ms
コンパイル使用メモリ 74,424 KB
実行使用メモリ 54,592 KB
最終ジャッジ日時 2024-11-19 08:10:00
合計ジャッジ時間 5,780 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a=scanner.nextInt();
		int b=scanner.nextInt();
		if(a==b) {
			System.out.println(Math.sqrt(Math.pow(a, 2)*2));
			return;
		}
		double c=Math.pow(Math.max(a, b),2)-Math.pow(Math.min(a, b), 2);
		System.out.println(Math.sqrt(c));
	}
}
0