結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー finefine
提出日時 2016-10-10 00:17:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 703 bytes
コンパイル時間 1,592 ms
コンパイル使用メモリ 168,512 KB
実行使用メモリ 10,664 KB
最終ジャッジ日時 2024-05-01 18:44:03
合計ジャッジ時間 8,092 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MOD = 1000000009;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    for (int testcase = 0; testcase < t; testcase++) {
        ll tmp;
        cin >> tmp;
        tmp /= 111111;
        int m = (int)tmp;
        vector<int> dp(m + 1, 0);
        dp[0] = 1;
        for (int i = 1; i <= 9; i++) {
            for (int j = 0; j <= m; j++) {
                if (i + j > m) continue;
                (dp[i + j] += dp[j]) %= MOD;
            }
        }
        int ans = 0;
        for (int i = 0; i <= m; i++) (ans += dp[i]) %= MOD;
        cout << ans << endl;
    }
    return 0;
}
0