結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー krotonkroton
提出日時 2015-06-16 00:37:36
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 23 ms / 5,000 ms
コード長 459 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 52,264 KB
実行使用メモリ 4,392 KB
最終ジャッジ日時 2023-09-21 02:51:52
合計ジャッジ時間 1,209 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 9;
const int MAX = 100000;

int coin[] = {1, 1, 2, 3, 4, 5, 6, 7, 8, 9};
ll dp[MAX];

int main(){
  dp[0] = 1;
  for(int i=0;i<10;i++){
    for(int sum=0;sum+coin[i]<MAX;sum++){
      dp[sum+coin[i]] += dp[sum];
      dp[sum+coin[i]] %= MOD;
    }
  }
  
  int T;
  cin >> T;
  
  while(T--){
    ll M;
    cin >> M;
    
    cout << dp[M / 111111] << endl;
  }
  return 0;
}
0