結果

問題 No.1011 Infinite Stairs
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2020-06-03 00:37:24
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 122,368 KB
実行使用メモリ 217,088 KB
最終ジャッジ日時 2024-05-07 21:43:09
合計ジャッジ時間 2,677 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 5 ms
6,144 KB
testcase_03 AC 154 ms
143,232 KB
testcase_04 AC 43 ms
27,648 KB
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 25 ms
20,992 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 30 ms
26,752 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 60 ms
52,608 KB
testcase_26 AC 15 ms
13,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;
using int64 = long long;

const int MOD = 1000000007;

int main() {
    int n,d,k;
    cin >> n >> d >> k;

    vector<vector<int64>> dp(n+1, vector<int64>(k+d+1, 0LL));
    dp[0][0] = 1;

    for (int i=0; i<n; i++) {
        for (int j=i; j<(i+2)*d; j++) {
            if (k - j <= 0) continue;
            dp[i+1][j+1] += dp[i][j];
            dp[i+1][j+1+d] -= dp[i][j];
            dp[i+1][j+1] += dp[i+1][j];
            dp[i+1][j+1] %= MOD;
        }
    }
    cout << dp[n][k] << endl;
}


/*
 * 1 0 0 0
 * 0 1 1 0
 * 0 0 1 2 1 0
 * 0 0 0 1 3 3 1 
*/
0