結果
問題 |
No.1892 Extended Fib Series
|
ユーザー |
![]() |
提出日時 | 2022-10-07 09:30:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 382 bytes |
コンパイル時間 | 1,595 ms |
コンパイル使用メモリ | 166,940 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-11 17:15:15 |
合計ジャッジ時間 | 2,419 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 15 WA * 4 |
other | AC * 5 WA * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n,l; cin>>n>>l; const ll mod=1e9+7; ll dp[n+1]; dp[0]=1; dp[1]=1; ll ruiseki=2; for(int i=2;i<=n;i++){ if(i-l>0){ ruiseki=(ruiseki-dp[i-l]+mod)%mod; } dp[i]=ruiseki; ruiseki=(ruiseki+dp[i])%mod; } cout<<dp[n]<<endl; }