結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー Tatsu_mr
提出日時 2024-09-18 05:03:39
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 598 bytes
コンパイル時間 2,831 ms
コンパイル使用メモリ 244,832 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-19 21:42:23
合計ジャッジ時間 3,597 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using lint = long long;

int main() {
    int t;
    cin >> t;
    while (t--) {
        lint m;
        cin >> m;
        lint ans = 0;
        lint ten = 1;
        for (lint i = 1; i <= 9; i++) {
            lint d;
            cin >> d;
            while (d--) {
                ans += ten * i;
                ten *= 10LL;
            }
        }
        lint digit = to_string(m - 1).size();
        ans *= powl(10LL, digit);
        lint r = ans % m;
        if (r > 0) {
            ans += m - r;
        }
        cout << ans << endl;
    }
}
0