結果

問題 No.1011 Infinite Stairs
ユーザー IlagIlag
提出日時 2020-03-20 22:14:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 1,828 ms
コンパイル使用メモリ 167,740 KB
実行使用メモリ 242,688 KB
最終ジャッジ日時 2024-12-15 06:18:32
合計ジャッジ時間 14,655 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<ll, ll>;
// Welcome to my source code!

const int MOD = 1000000007;
const int MAX_V = 100000;
const int MAX_N = 305;

ll dp[MAX_N + 5][MAX_V + 5];

int main() {
    ll n, d, k;
    cin >> n >> d >> k;
    dp[0][0] = 1;
    for (int i = 0; i <= MAX_N; i++) {
        for (int j = i + 1; j <= MAX_V; j++) {
            dp[i + 1][j] += dp[i][j - 1];
            if (j - d - 1 >= 0) dp[i + 1][j] -= dp[i][j - d - 1];
            dp[i + 1][j] %= MOD;
        }
        for (int j = 1; j <= MAX_V; j++) {
            dp[i + 1][j] += dp[i + 1][j - 1];
            dp[i + 1][j] %= MOD;
        }
    }
    cout << dp[n][k] << endl;
}
0