結果

問題 No.1011 Infinite Stairs
ユーザー granddaifukugranddaifuku
提出日時 2020-04-28 00:33:44
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 899 bytes
コンパイル時間 1,574 ms
コンパイル使用メモリ 170,616 KB
実行使用メモリ 174,992 KB
最終ジャッジ日時 2023-08-14 18:03:43
合計ジャッジ時間 5,979 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,752 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 9 ms
5,972 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
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 <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, d, k;
    cin >> n >> d >> k;
    // ll dp[n + 1][k + 1];
    vector<vector<ll> > dp(n + 1, vector<ll>(k + 1));
    dp[0][0] = 1;
    rep (i, n) {
        rep (j, k) {
            if (dp[i][j] != 0) {
                FOR (l, 1, d + 1) {
                    if (j + l > k) break;
                    dp[i + 1][j + l] += dp[i][j];
                    dp[i + 1][j + l] %= MOD;
                }
            }
        }
    }
    cout << dp[n][k] << endl;
    
    return 0;
}

0