結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー ふーらくたるふーらくたる
提出日時 2016-08-05 19:37:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 792 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 59,096 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 15:41:47
合計ジャッジ時間 788 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

typedef long long ll;

const ll MOD = 1000 * 1000 * 1000 + 9;
const ll MAX_M = 10000000000LL;

const auto PRICE1 = 111111;

int main() {
    int T;
    cin >> T;

    static vector<ll> count(MAX_M / PRICE1 + 1, 0);
    count[0] = 1;
    for (auto price = 1; price <= 9; price++) {
        for (auto use = 0; use < count.size(); use++) {
            if (use - price < 0) continue;
            count[use] += count[use - price];
            count[use] %= MOD;
        }
    }
    for (auto use = 0; use < count.size(); use++) {
        count[use] += count[use - 1];
        count[use] %= MOD;
    }

    while (T--) {
        ll M;
        cin >> M;

        cout << count[M / PRICE1] << endl;
    }
    return 0;
}
0