結果
| 問題 | No.2562 数字探しゲーム(緑以下コンver.) | 
| コンテスト | |
| ユーザー |  Jikky1618 | 
| 提出日時 | 2025-09-03 08:30:13 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 13 ms / 2,000 ms | 
| コード長 | 727 bytes | 
| コンパイル時間 | 3,188 ms | 
| コンパイル使用メモリ | 281,840 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-09-03 08:30:18 | 
| 合計ジャッジ時間 | 4,346 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...)
#endif
void solve() {
    int M;
    vector<int> d(9);
    cin >> M;
    for (int i = 0; i < 9; i++) cin >> d[i];
    // corner case: d[i] = 0
    if (reduce(d.begin(), d.end()) == 0) {
        cout << M << '\n';
        return;
    }
    string tmp = "";
    for (int i = 0; i < 9; i++) tmp += string(d[i], i + '1');
    tmp += string(9, '0');
    ll ans = stoll(tmp);
    ans += (ans % M ? M - (ans % M) : 0);
    cout << ans << '\n';
}
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int T;
    cin >> T;
    while (T--) solve();
}
            
            
            
        