結果

問題 No.419 直角三角形
ユーザー maninimanini
提出日時 2016-09-11 01:13:55
言語 Java19
(openjdk 21)
結果
AC  
実行時間 119 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 1,725 ms
コンパイル使用メモリ 71,380 KB
実行使用メモリ 56,668 KB
最終ジャッジ日時 2023-08-10 16:46:34
合計ジャッジ時間 5,448 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
56,416 KB
testcase_01 AC 112 ms
56,296 KB
testcase_02 AC 118 ms
55,932 KB
testcase_03 AC 114 ms
56,192 KB
testcase_04 AC 116 ms
55,536 KB
testcase_05 AC 112 ms
54,508 KB
testcase_06 AC 113 ms
56,132 KB
testcase_07 AC 115 ms
56,668 KB
testcase_08 AC 114 ms
56,192 KB
testcase_09 AC 113 ms
56,228 KB
testcase_10 AC 113 ms
56,248 KB
testcase_11 AC 111 ms
55,924 KB
testcase_12 AC 117 ms
56,016 KB
testcase_13 AC 119 ms
55,932 KB
testcase_14 AC 118 ms
55,808 KB
testcase_15 AC 115 ms
56,448 KB
testcase_16 AC 116 ms
56,468 KB
testcase_17 AC 113 ms
56,044 KB
testcase_18 AC 112 ms
56,288 KB
testcase_19 AC 112 ms
55,760 KB
testcase_20 AC 114 ms
55,488 KB
testcase_21 AC 115 ms
55,816 KB
testcase_22 AC 113 ms
56,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long a=s.nextInt();
		long b=s.nextInt();
		if(a!=b){
		long max=Math.max(a, b);
		long min=Math.min(a, b);
		
		double c=Math.sqrt((double)max*max-min*min);
		System.out.println(c);
		}else{
			double c=Math.sqrt((double)a*a+b*b);
			System.out.println(c);
		}
	}
}
0