結果

問題 No.1011 Infinite Stairs
ユーザー zero_kprzero_kpr
提出日時 2020-03-22 05:10:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 620 bytes
コンパイル時間 1,487 ms
コンパイル使用メモリ 166,312 KB
実行使用メモリ 214,968 KB
最終ジャッジ日時 2023-09-24 11:07:17
合計ジャッジ時間 3,969 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,412 KB
testcase_01 AC 3 ms
7,436 KB
testcase_02 AC 42 ms
181,768 KB
testcase_03 AC 170 ms
205,760 KB
testcase_04 AC 66 ms
212,556 KB
testcase_05 AC 240 ms
214,968 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 25 ms
114,184 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
5,396 KB
testcase_10 AC 12 ms
52,540 KB
testcase_11 AC 65 ms
192,144 KB
testcase_12 AC 12 ms
50,664 KB
testcase_13 AC 38 ms
104,308 KB
testcase_14 AC 14 ms
64,792 KB
testcase_15 AC 53 ms
155,200 KB
testcase_16 AC 128 ms
190,804 KB
testcase_17 AC 49 ms
202,140 KB
testcase_18 AC 82 ms
147,520 KB
testcase_19 AC 9 ms
38,508 KB
testcase_20 AC 9 ms
38,272 KB
testcase_21 AC 42 ms
96,008 KB
testcase_22 AC 78 ms
169,908 KB
testcase_23 AC 44 ms
85,988 KB
testcase_24 AC 51 ms
114,656 KB
testcase_25 AC 80 ms
171,880 KB
testcase_26 AC 24 ms
67,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// AtCoder template
// sabaより胡蝶しのぶさんの方が可愛いのではないか?
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)


ll dp[301][90001];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    const ll MOD = 1e9 + 7;
    int n,d,k; cin >> n >> d >> k;
    
    dp[0][0] = 1LL;
    rep(i,n){ // i回目の行動
        vector<ll> dpsum(k+2,0LL);
        rep(j,k) dpsum[j+1] = (dpsum[j] + dp[i][j]) % MOD;
        rep(j,k) dp[i+1][j+1] = (dpsum[j+1]-dpsum[max(0,j-d+1)] + MOD) % MOD;
    }
    cout << dp[n][k] << endl;
}
0