結果
| 問題 | No.41 貯金箱の溜息(EASY) | 
| コンテスト | |
| ユーザー |  hogeover30 | 
| 提出日時 | 2015-03-03 20:02:12 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 10 ms / 5,000 ms | 
| コード長 | 432 bytes | 
| コンパイル時間 | 346 ms | 
| コンパイル使用メモリ | 23,936 KB | 
| 実行使用メモリ | 8,628 KB | 
| 最終ジャッジ日時 | 2024-06-24 01:16:07 | 
| 合計ジャッジ時間 | 645 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     int T; scanf("%d", &T);
      |            ~~~~~^~~~~~~~~~
main.cpp:17:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         ll M; scanf("%lld", &M);
      |               ~~~~~^~~~~~~~~~~~
            
            ソースコード
#include <cstdio>
typedef long long ll;
const int mod=1e9+9;
ll dp[10][100010];
#define max(x, y) (x>y?x:y)
int main()
{
    dp[0][0]=1;
    for(int i=1;i<10;++i) {
        for(int j=0;j<100010;++j) {
            dp[i][j]=((j>=i?dp[i][j-i]:0)+max(1,dp[i-1][j]))%mod;
        }
    }
    int T; scanf("%d", &T);
    while (T--) {
        ll M; scanf("%lld", &M);
        M/=111111;
        printf("%lld\n", dp[M>9?9:M][M]);
    }
}
            
            
            
        