結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー GOTKAKO
提出日時 2024-11-29 22:37:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 483 bytes
コンパイル時間 1,898 ms
コンパイル使用メモリ 195,104 KB
最終ジャッジ日時 2025-02-26 09:24:32
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int test; cin >> test;
    while(test--){
        long long M; cin >> M;

        string s = "";
        for(int i=1; i<=9; i++){
            int d; cin >> d;
            while(d--) s += '0'+i;
        }
		if(s == ""){cout << M << endl; continue;}
        long long D = stoll(s);
        D *= 1e9;
        D += (M-D%M)%M;
        cout << D << endl;   
    }
}
0