結果

問題 No.1980 [Cherry 4th Tune D] 停止距離
ユーザー kokatsukokatsu
提出日時 2022-06-18 00:18:43
言語 D
(dmd 2.105.2)
結果
AC  
実行時間 394 ms / 3,000 ms
コード長 756 bytes
コンパイル時間 4,076 ms
コンパイル使用メモリ 202,604 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-04 17:30:06
合計ジャッジ時間 16,187 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 71 ms
4,376 KB
testcase_02 AC 279 ms
4,376 KB
testcase_03 AC 195 ms
4,376 KB
testcase_04 AC 50 ms
4,376 KB
testcase_05 AC 249 ms
4,380 KB
testcase_06 AC 389 ms
4,376 KB
testcase_07 AC 393 ms
4,376 KB
testcase_08 AC 389 ms
4,380 KB
testcase_09 AC 387 ms
4,380 KB
testcase_10 AC 388 ms
4,380 KB
testcase_11 AC 387 ms
4,376 KB
testcase_12 AC 388 ms
4,376 KB
testcase_13 AC 387 ms
4,376 KB
testcase_14 AC 387 ms
4,380 KB
testcase_15 AC 385 ms
4,376 KB
testcase_16 AC 391 ms
4,376 KB
testcase_17 AC 392 ms
4,376 KB
testcase_18 AC 393 ms
4,376 KB
testcase_19 AC 392 ms
4,380 KB
testcase_20 AC 390 ms
4,380 KB
testcase_21 AC 392 ms
4,376 KB
testcase_22 AC 391 ms
4,380 KB
testcase_23 AC 394 ms
4,380 KB
testcase_24 AC 392 ms
4,376 KB
testcase_25 AC 394 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

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

    bool S(long v, long t, long m, long l) {
        long C = 36;

        l *= C * C * m * (10 ^^ 2);
        long r = C * m * v * t + v * v * 5;

        return l >= r;
    }

    foreach (_; 0 .. N) {
        long T1, T2, mu1, mu2, L1, L2;
        readf("%d.%d %d.%d %d.%d\n", T1, T2, mu1, mu2, L1, L2);

        long T = T1 * 100 + T2;
        long mu = mu1 * 100 + mu2;
        long L = L1 * 100 + L2;

        long ok, ng = 6_000_000;
        while (ng - ok > 1) {
            long mid = (ok + ng) / 2;
            (S(mid, T, mu, L) ? ok : ng) = mid;
        }

        long I = ok / 1000;
        auto F = format("%03d", ok % 1000);
        F.popBack;
        writeln(I, ".", F);
    }
}
0