結果

問題 No.1011 Infinite Stairs
ユーザー zumin
提出日時 2021-03-28 17:20:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 74,860 KB
実行使用メモリ 109,568 KB
最終ジャッジ日時 2024-07-17 12:17:03
合計ジャッジ時間 3,037 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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