結果

問題 No.1011 Infinite Stairs
ユーザー SSRSSSRS
提出日時 2020-11-07 11:09:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 623 ms
コンパイル使用メモリ 71,972 KB
実行使用メモリ 215,692 KB
最終ジャッジ日時 2023-09-24 11:22:02
合計ジャッジ時間 3,544 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 9 ms
9,228 KB
testcase_03 AC 159 ms
143,312 KB
testcase_04 AC 237 ms
215,592 KB
testcase_05 AC 234 ms
215,692 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 30 ms
28,264 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 10 ms
10,408 KB
testcase_11 AC 99 ms
91,012 KB
testcase_12 AC 5 ms
6,228 KB
testcase_13 AC 54 ms
49,172 KB
testcase_14 AC 6 ms
6,712 KB
testcase_15 AC 36 ms
32,596 KB
testcase_16 AC 163 ms
150,280 KB
testcase_17 AC 173 ms
160,420 KB
testcase_18 AC 72 ms
65,288 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 9 ms
8,596 KB
testcase_21 AC 40 ms
36,816 KB
testcase_22 AC 146 ms
135,600 KB
testcase_23 AC 37 ms
34,992 KB
testcase_24 AC 37 ms
33,860 KB
testcase_25 AC 72 ms
65,160 KB
testcase_26 AC 20 ms
18,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
const long long MOD = 1000000007;
int main(){
	int N, d, K;
	cin >> N >> d >> K;
	vector<vector<long long>> dp(N + 1, vector<long long>(N * d + 2, 0));
	dp[0][0] = 1;
	for (int i = 0; i < N; i++){
		for (int j = 0; j <= i * d; j++){
			dp[i + 1][j + 1] += dp[i][j];
			dp[i + 1][j + d + 1] += MOD - dp[i][j];
		}
		for (int j = 0; j <= (i + 1) * d; j++){
			dp[i + 1][j + 1] += dp[i + 1][j];
			dp[i + 1][j + 1] %= MOD;
		}
	}
	cout << dp[N][K] << endl;
}
0