結果

問題 No.1011 Infinite Stairs
ユーザー zuminzumin
提出日時 2021-03-28 17:20:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 74,144 KB
実行使用メモリ 109,496 KB
最終ジャッジ日時 2023-09-24 11:24:02
合計ジャッジ時間 3,248 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 7 ms
6,176 KB
testcase_03 AC 143 ms
73,024 KB
testcase_04 AC 216 ms
109,460 KB
testcase_05 AC 216 ms
109,496 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 25 ms
15,544 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 9 ms
6,768 KB
testcase_11 AC 91 ms
47,488 KB
testcase_12 AC 4 ms
4,648 KB
testcase_13 AC 48 ms
26,376 KB
testcase_14 AC 5 ms
4,824 KB
testcase_15 AC 30 ms
17,780 KB
testcase_16 AC 152 ms
77,188 KB
testcase_17 AC 159 ms
81,976 KB
testcase_18 AC 65 ms
34,724 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 7 ms
5,976 KB
testcase_21 AC 33 ms
19,700 KB
testcase_22 AC 135 ms
69,264 KB
testcase_23 AC 35 ms
19,000 KB
testcase_24 AC 31 ms
18,304 KB
testcase_25 AC 60 ms
33,868 KB
testcase_26 AC 16 ms
10,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <atcoder/modint>

using namespace std;
using namespace atcoder;

using mint=modint1000000007;

int main(){
    int n,d,k;
    cin>>n>>d>>k;
    vector<vector<mint>> dp(n+1,vector<mint>(d*n+1));
    dp[0][0]=1;

    for(int i=0;i<n;i++){
        for(int st=1;st<=d*n;st++){
            dp[i+1][st]=dp[i+1][st-1]+dp[i][st-1]-(st-d>=1?dp[i][st-1-d]:0);
        }
    }
    cout<<dp[n][k].val()<<endl;

    return 0;
}
0