結果
| 問題 | No.41 貯金箱の溜息(EASY) | 
| コンテスト | |
| ユーザー |  tottoripaper | 
| 提出日時 | 2014-11-24 03:09:51 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 8 ms / 5,000 ms | 
| コード長 | 676 bytes | 
| コンパイル時間 | 263 ms | 
| コンパイル使用メモリ | 28,160 KB | 
| 実行使用メモリ | 7,856 KB | 
| 最終ジャッジ日時 | 2025-01-02 21:06:52 | 
| 合計ジャッジ時間 | 718 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |     scanf("%d", &T);
      |     ~~~~~^~~~~~~~~~
main.cpp:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         scanf("%lld", &M);
      |         ~~~~~^~~~~~~~~~~~
            
            ソースコード
#include <cstdio>
typedef long long ll;
const ll MOD = 1000000000 + 9;
ll dp[10][90002];
int main(){
    dp[0][0] = 1ll;
    
    for(int i=1;i<10;i++){
        for(int j=0;j<=90001;j++){
            dp[i][j] = dp[i-1][j];
            if(j-i >= 0){
                dp[i][j] = (dp[i][j] + dp[i][j-i]) % MOD;
            }
        }
    }
    for(int j=1;j<=90001;j++){
        dp[9][j] = (dp[9][j] + dp[9][j-1]) % MOD;
    }
    int T;
    scanf("%d", &T);
    for(int _=0;_<T;_++){
        ll M;
        scanf("%lld", &M);
        
        int k = static_cast<int>(M / 111111ll);
        
        printf("%lld\n", dp[9][k]);
    }
}
            
            
            
        