結果

問題 No.1011 Infinite Stairs
ユーザー ngtkanangtkana
提出日時 2020-03-27 23:04:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 620 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 204,392 KB
実行使用メモリ 215,536 KB
最終ジャッジ日時 2023-09-24 11:10:49
合計ジャッジ時間 5,574 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 10 ms
6,000 KB
testcase_03 AC 408 ms
143,272 KB
testcase_04 AC 71 ms
26,512 KB
testcase_05 AC 620 ms
215,536 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 6 ms
4,596 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 5 ms
4,380 KB
testcase_11 AC 84 ms
31,528 KB
testcase_12 AC 4 ms
4,376 KB
testcase_13 AC 52 ms
20,412 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 67 ms
25,684 KB
testcase_16 AC 285 ms
100,968 KB
testcase_17 AC 26 ms
11,164 KB
testcase_18 AC 165 ms
59,480 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 70 ms
26,124 KB
testcase_22 AC 138 ms
49,308 KB
testcase_23 AC 83 ms
30,500 KB
testcase_24 AC 90 ms
33,372 KB
testcase_25 AC 145 ms
52,376 KB
testcase_26 AC 30 ms
13,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
lint mod=1'000'000'007;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n,d,K;std::cin>>n>>d>>K;
    std::vector<std::vector<lint>>dp(n+1,std::vector<lint>(K+2));
    for(lint i=1;i<=K+1;i++)dp.at(0).at(i)=1;
    for(lint i=0;i<n;i++){
        for(lint j=1;j<=K+1;j++){
            dp.at(i+1).at(j)=
                (dp.at(i+1).at(j-1)
                +dp.at(i).at(j-1)
                -dp.at(i).at(std::max(0ll,j-1-d))+mod)%mod;
        }
    }
    std::cout<<(dp.at(n).at(K+1)-dp.at(n).at(K)+mod)%mod<<'\n';
}
0