結果

問題 No.1011 Infinite Stairs
ユーザー Y17Y17
提出日時 2020-03-20 21:43:32
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 1,377 ms
コンパイル使用メモリ 163,912 KB
実行使用メモリ 215,072 KB
最終ジャッジ日時 2023-09-24 10:54:53
合計ジャッジ時間 3,813 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,232 KB
testcase_01 AC 3 ms
8,220 KB
testcase_02 AC 34 ms
102,352 KB
testcase_03 AC 168 ms
172,832 KB
testcase_04 AC 58 ms
113,844 KB
testcase_05 AC 231 ms
215,072 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 29 ms
108,748 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
6,164 KB
testcase_10 AC 15 ms
53,312 KB
testcase_11 AC 63 ms
121,716 KB
testcase_12 AC 14 ms
51,324 KB
testcase_13 AC 41 ms
104,764 KB
testcase_14 AC 18 ms
65,744 KB
testcase_15 AC 53 ms
116,120 KB
testcase_16 AC 130 ms
152,068 KB
testcase_17 AC 42 ms
113,272 KB
testcase_18 AC 84 ms
124,280 KB
testcase_19 AC 12 ms
39,072 KB
testcase_20 AC 11 ms
38,952 KB
testcase_21 AC 42 ms
96,676 KB
testcase_22 AC 77 ms
122,992 KB
testcase_23 AC 43 ms
86,480 KB
testcase_24 AC 51 ms
107,608 KB
testcase_25 AC 83 ms
124,712 KB
testcase_26 AC 26 ms
67,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dp[310][90010];

#define MOD 1000000007 

signed main(){
	int n, d, k;
	cin >> n >> d >> k;
	
	dp[0][0] = 1; 
	for(int i = 1;i <= n;i++){
		int rui[100010] = {};
		for(int j = 0;j <= k;j++){
			rui[j+1] = (rui[j] + dp[i-1][j]) % MOD;
		}

		dp[i][0] = 0;
		for(int j = 1;j <= k;j++){
			dp[i][j] = (MOD + rui[j] - rui[max(0ll, j-d)]) % MOD;
		}
	}

	cout << dp[n][k] << endl;

	return 0;
}
0