結果

問題 No.1011 Infinite Stairs
ユーザー Y17
提出日時 2020-03-20 21:43:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 1,421 ms
コンパイル使用メモリ 167,744 KB
実行使用メモリ 215,184 KB
最終ジャッジ日時 2024-07-17 11:46:29
合計ジャッジ時間 3,668 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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