結果
| 問題 |
No.980 Fibonacci Convolution Hard
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2020-02-28 06:17:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 381 bytes |
| コンパイル時間 | 902 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 229,708 KB |
| 最終ジャッジ日時 | 2024-10-13 16:20:04 |
| 合計ジャッジ時間 | 12,047 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 1 |
ソースコード
import sys
input = sys.stdin.readline
mod=1000000007
p=int(input())
q=int(input())
Q=[int(input()) for i in range(q)]
ANS=[0,0,0,0]
A=[0,1]
A.append(p*A[-1]+A[-2])
A.append(p*A[-1]+A[-2])
ANS[2]=A[0]*A[2]*2+A[1]*A[1]
ANS[3]=A[0]*A[3]*2+A[1]*A[2]*2
for i in range(2*10**6):
ANS.append((2*p*ANS[-1]-(p**2-2)*ANS[-2]-2*p*ANS[-3]-ANS[-4])%mod)
for q in Q:
print(ANS[q-2])
titia