結果

問題 No.1178 Can you draw a Circle?
ユーザー ks2m
提出日時 2020-08-21 22:43:56
言語 Java
(openjdk 23)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 2,482 ms
コンパイル使用メモリ 75,352 KB
実行使用メモリ 41,792 KB
最終ジャッジ日時 2024-11-07 14:07:44
合計ジャッジ時間 5,650 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

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