結果

問題 No.419 直角三角形
ユーザー maninimanini
提出日時 2016-09-11 01:13:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 113 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 1,887 ms
コンパイル使用メモリ 74,708 KB
実行使用メモリ 41,468 KB
最終ジャッジ日時 2024-04-28 10:09:41
合計ジャッジ時間 5,100 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
40,428 KB
testcase_01 AC 101 ms
40,596 KB
testcase_02 AC 102 ms
40,392 KB
testcase_03 AC 98 ms
40,280 KB
testcase_04 AC 108 ms
40,996 KB
testcase_05 AC 110 ms
41,196 KB
testcase_06 AC 100 ms
39,872 KB
testcase_07 AC 106 ms
40,876 KB
testcase_08 AC 107 ms
41,468 KB
testcase_09 AC 102 ms
39,812 KB
testcase_10 AC 111 ms
41,264 KB
testcase_11 AC 108 ms
39,864 KB
testcase_12 AC 108 ms
41,280 KB
testcase_13 AC 109 ms
40,112 KB
testcase_14 AC 102 ms
40,200 KB
testcase_15 AC 101 ms
40,220 KB
testcase_16 AC 102 ms
40,340 KB
testcase_17 AC 113 ms
39,732 KB
testcase_18 AC 107 ms
39,736 KB
testcase_19 AC 105 ms
40,140 KB
testcase_20 AC 111 ms
40,784 KB
testcase_21 AC 99 ms
40,420 KB
testcase_22 AC 113 ms
40,928 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