結果
問題 |
No.1892 Extended Fib Series
|
ユーザー |
![]() |
提出日時 | 2025-03-20 21:13:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 348 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 82,540 KB |
実行使用メモリ | 61,104 KB |
最終ジャッジ日時 | 2025-03-20 21:14:43 |
合計ジャッジ時間 | 2,882 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 19 |
other | AC * 14 |
ソースコード
mod = 10**9 + 7 n, l = map(int, input().split()) dp = [0] * (n + 1) dp[0] = 1 current_sum = 1 # sum of dp[0...i-1] for the first i=1 for i in range(1, n + 1): dp[i] = current_sum % mod if i >= l: current_sum = (current_sum + dp[i] - dp[i - l]) % mod else: current_sum = (current_sum + dp[i]) % mod print(dp[n] % mod)