結果
| 問題 |
No.978 Fibonacci Convolution Easy
|
| ユーザー |
|
| 提出日時 | 2023-01-18 07:00:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 394 bytes |
| コンパイル時間 | 369 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 77,312 KB |
| 最終ジャッジ日時 | 2024-06-11 10:15:56 |
| 合計ジャッジ時間 | 2,639 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 RE * 1 |
ソースコード
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
N,p = map(int,input().split())
mod = 10**9 + 7
a = [0]*(N+1)
a[2]=1
ans = 0
S = 0
if N==1:
print(0)
exit()
ans = 1
S = 1
for i in range(3,N+1):
a[i]=(p*a[i-1]+a[i-2])%mod
S += a[i]
ans += S*a[i]
ans %= mod
S %= mod
print(ans)