結果

問題 No.419 直角三角形
ユーザー GrenacheGrenache
提出日時 2016-09-09 22:26:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 1,000 ms
コード長 672 bytes
コンパイル時間 3,252 ms
コンパイル使用メモリ 72,716 KB
実行使用メモリ 56,344 KB
最終ジャッジ日時 2023-08-10 08:26:51
合計ジャッジ時間 7,351 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,872 KB
testcase_01 AC 125 ms
55,504 KB
testcase_02 AC 124 ms
54,496 KB
testcase_03 AC 124 ms
55,676 KB
testcase_04 AC 125 ms
56,112 KB
testcase_05 AC 126 ms
56,132 KB
testcase_06 AC 128 ms
55,952 KB
testcase_07 AC 127 ms
56,092 KB
testcase_08 AC 129 ms
56,344 KB
testcase_09 AC 125 ms
55,840 KB
testcase_10 AC 126 ms
55,856 KB
testcase_11 AC 126 ms
56,008 KB
testcase_12 AC 127 ms
55,848 KB
testcase_13 AC 126 ms
56,060 KB
testcase_14 AC 127 ms
56,188 KB
testcase_15 AC 124 ms
55,892 KB
testcase_16 AC 125 ms
55,952 KB
testcase_17 AC 125 ms
55,828 KB
testcase_18 AC 123 ms
55,808 KB
testcase_19 AC 123 ms
56,092 KB
testcase_20 AC 125 ms
56,268 KB
testcase_21 AC 124 ms
56,004 KB
testcase_22 AC 126 ms
55,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder419 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();

		double c;
		if (a == b) {
			c = Math.sqrt(a * a + b * b);
		} else {
			c = Math.sqrt(Math.abs(a * a - b * b));
		}

		pr.printf("%.7f\n", c);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0