結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー miiitomimiiitomi
提出日時 2023-12-02 15:13:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 2,167 ms
コンパイル使用メモリ 202,804 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 15:13:35
合計ジャッジ時間 3,207 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 34 ms
6,676 KB
testcase_05 AC 34 ms
6,676 KB
testcase_06 AC 33 ms
6,676 KB
testcase_07 AC 34 ms
6,676 KB
testcase_08 AC 35 ms
6,676 KB
testcase_09 AC 34 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void solve() {
    ll M;
    cin >> M;
    vector<ll> d(10, 0);
    for (int i = 1; i <= 9; i++) cin >> d[i];
    ll s = 0;
    for (int i = 1; i <= 9; i++) {
        for (int k = 0; k < d[i]; k++) {
            s = s*10 + i;
        }
    }
    s *= (ll)1e+9;

    if (s % M == 0) cout << s << endl;
    else {
        ll a = M - (s % M);
        s += a;
        cout << s << endl;
    }
}

int main() {
    int T;
    cin >> T;
    for (int t = 0; t < T; t++) solve();
}
0