結果

問題 No.1980 [Cherry 4th Tune D] 停止距離
ユーザー kokatsukokatsu
提出日時 2022-06-17 21:41:40
言語 D
(dmd 2.105.2)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 2,192 ms
コンパイル使用メモリ 209,696 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-04 17:27:13
合計ジャッジ時間 22,113 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 135 ms
4,392 KB
testcase_02 WA -
testcase_03 AC 379 ms
4,468 KB
testcase_04 AC 97 ms
4,388 KB
testcase_05 AC 483 ms
4,424 KB
testcase_06 AC 759 ms
4,412 KB
testcase_07 AC 763 ms
4,416 KB
testcase_08 AC 762 ms
4,452 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 762 ms
4,404 KB
testcase_12 AC 758 ms
4,448 KB
testcase_13 AC 759 ms
4,424 KB
testcase_14 AC 759 ms
4,468 KB
testcase_15 AC 760 ms
4,404 KB
testcase_16 AC 786 ms
4,464 KB
testcase_17 AC 785 ms
4,388 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 786 ms
4,468 KB
testcase_22 AC 790 ms
4,388 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    int N;
    readf("%d\n", N);

    real MAX = 6000.0, EPS = 1e-10;

    real S(real v, real t, real m) {
        real u = v / 3.6;
        return u * t + u * u / (20.0 * m);
    }

    foreach (_; 0 .. N) {
        real T, mu, L;
        readf("%f %f %f\n", T, mu, L);

        real ok = 0.0, ng = MAX;
        while (ng - ok > EPS) {
            real mid = (ok + ng) / 2.0;

            real l = S(mid, T, mu);
            (l < L ? ok : ng) = mid;
        }

        auto tmp = format("%.10f", ok);
        dchar[] res;
        int cnt = -100;
        foreach (t; tmp) {
            if (cnt >= 2) break;

            res ~= t;
            if (t == '.') cnt = 0;
            else ++cnt;
        }

        res.writeln;
    }
}
0