結果

問題 No.419 直角三角形
ユーザー hermione17hermione17
提出日時 2016-09-09 22:37:20
言語 Java19
(openjdk 21)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 465 bytes
コンパイル時間 3,107 ms
コンパイル使用メモリ 71,792 KB
実行使用メモリ 56,568 KB
最終ジャッジ日時 2023-08-10 08:49:39
合計ジャッジ時間 7,241 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
55,944 KB
testcase_01 AC 135 ms
56,424 KB
testcase_02 AC 133 ms
56,208 KB
testcase_03 AC 130 ms
56,088 KB
testcase_04 AC 129 ms
56,332 KB
testcase_05 AC 126 ms
55,772 KB
testcase_06 AC 125 ms
56,000 KB
testcase_07 AC 131 ms
56,432 KB
testcase_08 AC 132 ms
56,452 KB
testcase_09 AC 127 ms
55,796 KB
testcase_10 AC 129 ms
56,568 KB
testcase_11 AC 130 ms
55,956 KB
testcase_12 AC 125 ms
56,324 KB
testcase_13 AC 134 ms
56,204 KB
testcase_14 AC 131 ms
56,104 KB
testcase_15 AC 132 ms
55,892 KB
testcase_16 AC 136 ms
56,216 KB
testcase_17 AC 135 ms
55,912 KB
testcase_18 AC 129 ms
56,128 KB
testcase_19 AC 127 ms
56,004 KB
testcase_20 AC 128 ms
56,232 KB
testcase_21 AC 125 ms
56,212 KB
testcase_22 AC 127 ms
54,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Y419 {
	Y419() {
	    Scanner sc = new Scanner(System.in);
	    double a = sc.nextDouble();
	    double b= sc.nextDouble();
	    
	    if (a > b) {
	    	double tmp = a;
	    	a = b;
	    	b = tmp;
	    }
	    
	    double c;
	    if (a == b) {
	    	c = Math.sqrt(a*a*2);
	    } else {
	    	c = Math.sqrt(b*b - a*a);
	    }
	    
	    System.out.println(c);
	}
	public static void main(String argv[]) {
		new Y419();
	}
}
0