結果
| 問題 |
No.1892 Extended Fib Series
|
| ユーザー |
|
| 提出日時 | 2024-11-30 23:04:20 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 630 bytes |
| コンパイル時間 | 3,714 ms |
| コンパイル使用メモリ | 246,828 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 23:04:25 |
| 合計ジャッジ時間 | 4,615 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 19 |
| other | AC * 14 |
ソースコード
#ifndef LOCAL
#include <bits/stdc++.h>
using namespace std;
#define debug(...) (void(0))
#else
#include "algo/debug.h"
#endif
#include <atcoder/modint>
using mint = atcoder::modint1000000007;
void solve() {
int N, L;
cin >> N >> L;
vector<mint> dp(N + 1);
dp[0] = 1;
mint sum = 1;
for (int i = 1; i <= N; i++) {
if (i > L) sum -= dp[i - L - 1];
dp[i] = sum;
sum += dp[i];
}
cout << dp.back().val() << endl;
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int tt = 1;
// std::cin >> tt;
while (tt--) {
solve();
}
}