結果
| 問題 |
No.1011 Infinite Stairs
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-03 00:34:51 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 614 bytes |
| コンパイル時間 | 868 ms |
| コンパイル使用メモリ | 122,240 KB |
| 実行使用メモリ | 217,216 KB |
| 最終ジャッジ日時 | 2024-11-30 18:17:14 |
| 合計ジャッジ時間 | 3,834 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 10 WA * 10 RE * 4 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
using int64 = long long;
const int MOD = 1000000007;
int main() {
int n,d,k;
cin >> n >> d >> k;
vector<vector<int64>> dp(n+1, vector<int64>(k+d+1, 0LL));
dp[0][0] = 1;
for (int i=0; i<n; i++) {
for (int j=i; j<(i+2)*d; j++) {
if (k < j) continue;
dp[i+1][j+1] += dp[i][j];
dp[i+1][j+1+d] -= dp[i][j];
dp[i+1][j+1] += dp[i+1][j];
dp[i+1][j+1] %= MOD;
}
}
cout << dp[n][k] << endl;
}
/*
* 1 0 0 0
* 0 1 1 0
* 0 0 1 2 1 0
* 0 0 0 1 3 3 1
*/