結果

問題 No.1178 Can you draw a Circle?
ユーザー ApassApass
提出日時 2020-08-21 23:35:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 1,224 bytes
コンパイル時間 3,157 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 41,108 KB
最終ジャッジ日時 2024-04-25 04:17:43
合計ジャッジ時間 5,582 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
40,988 KB
testcase_01 AC 91 ms
39,556 KB
testcase_02 AC 102 ms
40,216 KB
testcase_03 AC 115 ms
41,016 KB
testcase_04 AC 89 ms
39,920 KB
testcase_05 AC 106 ms
40,928 KB
testcase_06 AC 111 ms
41,100 KB
testcase_07 AC 94 ms
40,304 KB
testcase_08 AC 96 ms
40,428 KB
testcase_09 AC 101 ms
40,836 KB
testcase_10 AC 103 ms
41,108 KB
testcase_11 AC 95 ms
40,296 KB
testcase_12 AC 97 ms
39,964 KB
testcase_13 AC 101 ms
39,988 KB
testcase_14 AC 94 ms
40,020 KB
testcase_15 AC 114 ms
40,784 KB
testcase_16 AC 112 ms
40,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.*;
import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.stream.IntStream;

public class D_CanYouDrawACircle {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    private static StringTokenizer st;

    private static int readInt() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }

    public static void main(String[] args) throws IOException {
        solve();
        pw.close();
    }

    private static void solve() throws IOException {
        double a = readInt();
        double b = readInt();
        double c = readInt();
        double d = readInt();
        double e = readInt();
        double f = readInt();

        assert a == b;
        // a x 2 + b y 2 + c x + d y + e = f
        // r * r = (f-e-4 * c * c/a - 4 * d * d/b)/a
        double r = Math.sqrt((f - e + c * c / a / 4 + d * d / b / 4) / a);
        // wrong?!
        pw.printf("%.5f\n", r);
    }

}

0