結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー pessimist
提出日時 2025-06-15 15:05:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 3,137 ms
コンパイル使用メモリ 274,768 KB
実行使用メモリ 7,840 KB
最終ジャッジ日時 2025-06-15 15:05:08
合計ジャッジ時間 3,882 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MD=1000000009;
const int MX=100000;
int dp[MX];
int coins[9]={1,2,3,4,5,6,7,8,9};
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); 
    for_each(dp,dp+MX,[](auto& x){x=1;});
    for(int i=0;i<9;++i){
        for(int j=coins[i];j<MX;++j){
            dp[j]=(dp[j]+dp[j-coins[i]])%MD;
        }
    }
    int T;cin>>T;
    while(T--){
        ll M;cin>>M;
        cout<<dp[M/111111]<<'\n';
    }
    return 0;
}
0