結果

問題 No.1011 Infinite Stairs
ユーザー tarattata1tarattata1
提出日時 2020-03-20 22:07:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,121 bytes
コンパイル時間 2,134 ms
コンパイル使用メモリ 76,324 KB
実行使用メモリ 61,224 KB
最終ジャッジ日時 2023-08-21 16:47:40
合計ジャッジ時間 5,375 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,956 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 13 ms
6,368 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 <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

ll dp[90005][305];

void solve()
{
    int n, d, K;
    scanf("%d%d%d", &n, &d, &K);

    int i,j,k;
    dp[0][0] = 1;
    for (i = 0; i < K; i++) {
        for (k = 0; k < n; k++) {
            for (j = 1; j <= MIN(d, K - i); j++) {
                int p = i + j;
                dp[p][k+1] = (dp[p][k+1] + dp[i][k]) % MOD;
            }
        }
    }
    printf("%lld\n", dp[K][n]);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}
0