結果

問題 No.1011 Infinite Stairs
ユーザー trineutrontrineutron
提出日時 2020-03-21 00:56:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 299 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 2,133 ms
コンパイル使用メモリ 202,656 KB
実行使用メモリ 217,624 KB
最終ジャッジ日時 2023-09-24 11:03:31
合計ジャッジ時間 4,428 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 6 ms
6,296 KB
testcase_03 AC 198 ms
144,080 KB
testcase_04 AC 36 ms
26,968 KB
testcase_05 AC 299 ms
217,624 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 5 ms
5,004 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 3 ms
4,484 KB
testcase_11 AC 43 ms
32,032 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 27 ms
21,260 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 35 ms
26,164 KB
testcase_16 AC 141 ms
102,184 KB
testcase_17 AC 14 ms
11,740 KB
testcase_18 AC 82 ms
59,944 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 35 ms
26,592 KB
testcase_22 AC 67 ms
49,484 KB
testcase_23 AC 42 ms
31,572 KB
testcase_24 AC 45 ms
33,672 KB
testcase_25 AC 71 ms
52,472 KB
testcase_26 AC 17 ms
13,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    const int64_t mod = 1000000007;
    int n, d, k;
    cin >> n >> d >> k;
    vector<vector<int64_t>> dp(k + 1, vector<int64_t>(n + 1));
    dp.at(0).at(0) = 1;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= n; j++) {
            dp.at(i).at(j) += dp.at(i - 1).at(j) + dp.at(i - 1).at(j - 1);
            if (i - d - 1 >= 0) {
                dp.at(i).at(j) += mod - dp.at(i - d - 1).at(j - 1);
            }
            dp.at(i).at(j) %= mod;
        }
    }
    cout << dp.at(k).at(n) << endl;
}
0