結果

問題 No.1011 Infinite Stairs
ユーザー nagitaosu
提出日時 2020-03-20 21:53:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 584 bytes
コンパイル時間 739 ms
コンパイル使用メモリ 69,240 KB
実行使用メモリ 40,320 KB
最終ジャッジ日時 2024-12-15 05:30:14
合計ジャッジ時間 20,675 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
constexpr int MOD = 1e9 + 7;

int dp[301][90001];
int main(){
    int n, d, k; cin >> n >> d >> k;
    dp[0][0] = 1;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < k; ++j){
            if(dp[i][j] == 0){ continue; }
            for(int step=1; step < d + 1; ++step){
                if(j + step < k + 1){
                    dp[i+1][j+step] += dp[i][j];
                    dp[i+1][j+step] %= MOD;
                }
            } 
        }
    }
    cout << dp[n][k] << endl;
    return 0;
}
0