結果

問題 No.1011 Infinite Stairs
ユーザー ytftytft
提出日時 2021-04-20 05:04:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 330 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 9,452 ms
コンパイル使用メモリ 374,356 KB
実行使用メモリ 215,564 KB
最終ジャッジ日時 2023-09-24 11:25:15
合計ジャッジ時間 11,939 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 7 ms
6,236 KB
testcase_03 AC 219 ms
142,900 KB
testcase_04 AC 39 ms
26,488 KB
testcase_05 AC 330 ms
215,564 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 4 ms
4,760 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 47 ms
31,632 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 29 ms
20,412 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 38 ms
25,804 KB
testcase_16 AC 159 ms
101,116 KB
testcase_17 AC 15 ms
11,208 KB
testcase_18 AC 91 ms
59,476 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 39 ms
26,152 KB
testcase_22 AC 75 ms
49,292 KB
testcase_23 AC 45 ms
30,472 KB
testcase_24 AC 49 ms
33,352 KB
testcase_25 AC 80 ms
52,388 KB
testcase_26 AC 17 ms
13,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp=boost::multiprecision;
int main(){
    long long MOD=1000000007;
    int N,d,K;
    cin>>N>>d>>K;
    vector<vector<long long>> dp(N+1,vector<long long>(K+1,1));
    for(int i=1;i<N+1;++i){
        for(int j=0;j<K+1;++j){
            if(j-d-1>=0){
                dp[i][j]=(dp[i][j-1]+dp[i-1][j-1]-dp[i-1][j-d-1]+MOD)%MOD;
            }else if(j>0){
                dp[i][j]=(dp[i][j-1]+dp[i-1][j-1])%MOD;
            }else{
                dp[i][j]=0;
            }
        }
    }
    cout<<(MOD+dp[N][K]-dp[N][K-1])%MOD<<endl;
}
0