結果
| 問題 | No.41 貯金箱の溜息(EASY) | 
| コンテスト | |
| ユーザー |  Kutimoti_T | 
| 提出日時 | 2018-01-10 22:15:26 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1,878 ms / 5,000 ms | 
| コード長 | 976 bytes | 
| コンパイル時間 | 493 ms | 
| コンパイル使用メモリ | 67,392 KB | 
| 実行使用メモリ | 9,728 KB | 
| 最終ジャッジ日時 | 2024-12-23 17:07:01 | 
| 合計ジャッジ時間 | 2,916 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 | 
ソースコード
#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()
{
    FOR(i, 0, 9)
    {
        FOR(j, 0, 9009)
        {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    FOR(i, 1, 9)
    {
        FOR(j, 0, 90009)
        {
            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]);
        }
    }
    cin >> T;
    FOR(c, 0, T - 1)
    {
        cin >> M;
        int N = M / 111111;
        ll result = 0;
        FOR(i, 0, N)
        {
            result = MOD(result + dp[9][i]);
        }
        cout << result << endl;
    }
}
            
            
            
        