結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
コンテスト
ユーザー 学ぶマン
提出日時 2025-11-17 18:33:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,652 KB
実行使用メモリ 77,044 KB
最終ジャッジ日時 2025-11-17 18:33:23
合計ジャッジ時間 2,518 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

for i in range(T):
    M = int(input())
    D = list(map(int, input().split()))

    res = []
    for i in range(1, 10):
        for j in range(D[i - 1]):
            res.append(str(i))

    # '0' を 9個appendする
    for i in range(9):
        res.append('0')

    Y = int(''.join(res))

    # D がすべて0のとき
    if Y == 0:
        if M == 0:
            print(1)
        else:
            print(M)
        continue

    sho, amari = divmod(Y, M)
    ans = Y + (M - amari)%M
    print(ans)
0