結果

問題 No.1011 Infinite Stairs
ユーザー nagitaosunagitaosu
提出日時 2020-03-20 21:53:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 584 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 68,808 KB
実行使用メモリ 39,072 KB
最終ジャッジ日時 2023-08-21 16:18:38
合計ジャッジ時間 8,452 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 9 ms
5,388 KB
testcase_03 TLE -
testcase_04 AC 1,268 ms
15,496 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

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