結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー nononnonon
提出日時 2023-12-02 19:01:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 747 bytes
コンパイル時間 2,416 ms
コンパイル使用メモリ 202,536 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 19:01:48
合計ジャッジ時間 3,361 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 25 ms
6,676 KB
testcase_05 AC 24 ms
6,676 KB
testcase_06 AC 23 ms
6,676 KB
testcase_07 AC 25 ms
6,676 KB
testcase_08 AC 24 ms
6,676 KB
testcase_09 AC 25 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll T,M;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>T;
    for(;T--;)
    {
        cin>>M;
        vector<int>d(10,0);
        for(int i=1;i<=9;i++)cin>>d[i];
        ll ans=0;
        for(int i=1;i<=9;i++)
        {
            for(int j=0;j<d[i];j++)
            {
                ans*=10;
                ans+=i;
            }
        }
        assert(ans<=1e9);
        ans*=1e9;
        ans+=999999999;
        ans-=ans%M;
        assert(ans<=1e18);
        assert(ans%M==0);
        cout << ans << endl;
        while(ans)
        {
            d[ans%10]--;
            ans/=10;
        }
        for(int i=1;i<=9;i++)assert(d[i]<=0);
    }
}
0