結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
コンテスト
ユーザー InTheBloom
提出日時 2023-12-02 15:02:29
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 733 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,504 ms
コンパイル使用メモリ 172,348 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-14 01:44:05
合計ジャッジ時間 2,304 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import std;

void main () {
    int T = readln.chomp.to!int;
    foreach (_; 0..T) {
        int M = readln.chomp.to!int;
        int[] d = readln.split.to!(int[]);
        solve(M, d);
    }
}

void solve (int M, int[] d) {
    /* 条件がゆるいので、先に必要条件だけ揃えて後は端の方で調整する */
    long X = 0;
    int radix = 0;
    foreach (i; 0..d.length) {
        foreach (j; 0..d[i]) {
            X += (i+1)*10L^^radix;
            radix++;
        }
    }

    X *= 10L^^9;
    long cur = X % M;

    if (0 < cur) X += M - cur;

    writeln(X);
}

void read (T...) (string S, ref T args) {
    auto buf = S.split;
    foreach (i, ref arg; args) {
        arg = buf[i].to!(typeof(arg));
    }
}
0