結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2022-12-20 01:29:28
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 826 bytes
コンパイル時間 2,186 ms
コンパイル使用メモリ 108,352 KB
実行使用メモリ 10,768 KB
最終ジャッジ日時 2023-08-11 10:10:21
合計ジャッジ時間 1,742 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>

using namespace std;

const long long modc = 1e9+9;

int main(){

    long long T, M, q;
    cin >> T;
    vector<vector<long long>> dp(10, vector<long long>(90001));
    vector<long long> S(90001);
    dp[0][0] = 1;
    for (int i=1; i<=9; i++){
        for (int j=0; j<=90000; j++){
            dp[i][j] = dp[i-1][j];
            if (j-i >= 0) dp[i][j] = (dp[i][j] + dp[i][j-i]) % modc;
        }
    }
    S[0] = 1;
    for (int i=1; i<=90000; i++){
        S[i] = (S[i-1] + dp[9][i]) % modc;
    }

    for (int i=0; i<T; i++){
        cin >> M;
        q = M / 111111;
        cout << S[q] << endl;
    }

    return 0;
}

0