結果

問題 No.1011 Infinite Stairs
ユーザー minus9dminus9d
提出日時 2020-03-20 21:51:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,442 bytes
コンパイル時間 869 ms
コンパイル使用メモリ 99,480 KB
実行使用メモリ 150,052 KB
最終ジャッジ日時 2024-05-08 21:45:48
合計ジャッジ時間 4,443 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 53 ms
6,144 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 <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#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 ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b; return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b; return true;
    }
    return false;
}
#define pb push_back
#define mp make_pair
#define mt make_tuple

ll MOD = 1e9 + 7;
int main(void)
{
    cin.sync_with_stdio(false);
    ll N, D, K;
    cin >> N >> D >> K;

    // [行動回数][何段目か]
    vector<vector<ll>> dp(N + 1, vector<ll>(K + 1));
    dp[0][0] = 1;
    REP(n, N) {
        REP(k, K) {
            FOR(d, 1, D + 1) {
                if (k + d <= K) {
                    dp[n + 1][k + d] += dp[n][k];
                    dp[n + 1][k + d] %= MOD;
                }
            }
        }
    }
    // for(auto e: dp[N]) cout << e << " ";
    // cout << endl;

    cout << dp[N][K] << endl;

    return 0;
}
0