結果

問題 No.1042 愚直大学
ユーザー noriocnorioc
提出日時 2020-05-02 02:20:25
言語 D
(dmd 2.105.2)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 2,744 ms
コンパイル使用メモリ 215,916 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-04 07:38:09
合計ジャッジ時間 3,937 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

double calc(double p, double q) {
    double lo = 0;
    double hi = 10^^16;
    double ans = 0;
    foreach (_; 0..100) {
        auto m = (lo + hi) / 2;
        if (m * m <= p + q * m * log2(m)) {
            ans = max(ans, m);
            lo = m;
        } else hi = m;
    }
    return ans;
}

void main() {
    double p, q; scan(p, q);
    writefln("%.10f", calc(p, q));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
0