結果

問題 No.1011 Infinite Stairs
ユーザー zeronosu77108
提出日時 2020-03-20 22:24:04
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 566 bytes
コンパイル時間 747 ms
コンパイル使用メモリ 120,832 KB
実行使用メモリ 220,928 KB
最終ジャッジ日時 2024-11-30 16:59:55
合計ジャッジ時間 29,392 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 TLE * 6
権限があれば一括ダウンロードができます

ソースコード

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+1, 0));
    dp[0][0] = 1;
    for (int i=0; i<n; i++) {
        for (int j=0; j<=(n*d)+d; j++) {
            for (int l=1; l<=d; l++) {
                if (j + l > k) continue;
                if (dp[i+1][j+l] >= MOD) dp[i+1][j+l] %= MOD;
                dp[i+1][j+l] += dp[i][j];
            }
        }
    }

    cout << dp[n][k] % MOD << endl;
}
0