結果
| 問題 |
No.1011 Infinite Stairs
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-20 21:32:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 589 ms / 2,000 ms |
| コード長 | 572 bytes |
| コンパイル時間 | 2,666 ms |
| コンパイル使用メモリ | 192,372 KB |
| 最終ジャッジ日時 | 2025-01-09 08:16:25 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
a = a*b % MOD;
}
int main(){
int N, D, K;
cin >> N >> D >> K;
static int64_t dp[301][301*301] = {0};
dp[0][0] = 1;
for(int i=0; i<N; i++){
int64_t sum = 0;
for(int j=1; j<=K; j++){
add(sum, dp[i][j-1]);
if(j-D-1 >= 0) add(sum, MOD - dp[i][j-D-1]);
add(dp[i+1][j], sum);
}
}
cout << dp[N][K] << endl;
return 0;
}