結果

問題 No.1178 Can you draw a Circle?
ユーザー ks2mks2m
提出日時 2020-08-21 22:43:56
言語 Java19
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 1,900 ms
コンパイル使用メモリ 72,396 KB
実行使用メモリ 56,540 KB
最終ジャッジ日時 2023-08-07 10:17:29
合計ジャッジ時間 4,834 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,408 KB
testcase_01 AC 119 ms
56,028 KB
testcase_02 AC 118 ms
55,876 KB
testcase_03 AC 119 ms
56,472 KB
testcase_04 AC 117 ms
56,288 KB
testcase_05 AC 119 ms
56,104 KB
testcase_06 AC 118 ms
56,140 KB
testcase_07 AC 119 ms
56,540 KB
testcase_08 AC 118 ms
56,100 KB
testcase_09 AC 120 ms
56,324 KB
testcase_10 AC 119 ms
56,312 KB
testcase_11 AC 119 ms
55,944 KB
testcase_12 AC 117 ms
56,032 KB
testcase_13 AC 119 ms
55,960 KB
testcase_14 AC 119 ms
55,724 KB
testcase_15 AC 119 ms
55,844 KB
testcase_16 AC 119 ms
55,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double c = sc.nextInt();
		double d = sc.nextInt();
		double e = sc.nextInt();
		double f = sc.nextInt();
		sc.close();

		if (a != b) {
			throw new Exception();
		}

		c /= a;
		d /= a;
		f = (f - e) / a;

		c = c * c / 4;
		d = d * d / 4;
		f = f + c + d;
		if (f < 0) {
			throw new Exception();
		}
		System.out.println(Math.sqrt(f));
	}
}
0