結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー finefine
提出日時 2016-10-10 00:24:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 619 bytes
コンパイル時間 1,547 ms
コンパイル使用メモリ 167,172 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-05-01 18:44:17
合計ジャッジ時間 2,127 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;
    int dp[100000] = {};
    dp[0] = 1;
    for (int i = 1; i <= 9; i++) {
        for (int j = 0; j < 100000; j++) {
            if (i + j >= 100000) continue;
            (dp[i + j] += dp[j]) %= MOD;
        }
    }
    for (int i = 1; i < 100000; i++) (dp[i] += dp[i - 1]) %= MOD;
    for (int testcase = 0; testcase < t; testcase++) {
        ll m;
        cin >> m;
        cout << dp[m / 111111] << endl;
    }
    return 0;
}
0