結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー Kutimoti_TKutimoti_T
提出日時 2018-01-10 22:13:17
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,054 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 67,756 KB
実行使用メモリ 17,240 KB
最終ジャッジ日時 2023-08-25 10:40:18
合計ジャッジ時間 7,959 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 424 ms
17,240 KB
testcase_01 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;

typedef long long ll;

#define FOR(i, s, e) for (int i = (s); i <= (e); i++)

#define MOD(N) ((N) % 1000000009)


ll T;

ll M;

ll dp[10][90010];

int main()
{
    cin >> T;

    FOR(c,0,T - 1)
    {
        cin >> M;

        int N  = M / 111111;

        FOR(i,0,9)
        {
            FOR(j,0,9009)
            {
                dp[i][j] = 0;
            }
        }
        dp[0][0] = 1;

        FOR(i,1,9)
        {
            FOR(j,0,N)
            {
                if(j - i >= 0)
                {
                    dp[i][j] += dp[i - 1][j] + dp[i][j - i];
                }
                else
                {
                    dp[i][j] += dp[i - 1][j];
                }
                dp[i][j] = MOD(dp[i][j]);
            }
        }
        ll result = 0;
        FOR(i,0,N)
        {
            result = MOD(result + dp[9][i]);
        }

        cout << result << endl;
    }
}


0