結果

問題 No.980 Fibonacci Convolution Hard
ユーザー titiatitia
提出日時 2020-02-28 06:17:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 229,760 KB
最終ジャッジ日時 2024-04-21 17:25:01
合計ジャッジ時間 15,593 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 620 ms
206,316 KB
testcase_02 AC 629 ms
206,060 KB
testcase_03 AC 646 ms
206,060 KB
testcase_04 AC 629 ms
206,312 KB
testcase_05 AC 625 ms
206,180 KB
testcase_06 AC 625 ms
206,316 KB
testcase_07 AC 630 ms
206,304 KB
testcase_08 AC 628 ms
206,440 KB
testcase_09 AC 656 ms
206,564 KB
testcase_10 AC 622 ms
206,564 KB
testcase_11 AC 661 ms
206,312 KB
testcase_12 AC 629 ms
206,312 KB
testcase_13 AC 629 ms
206,312 KB
testcase_14 AC 628 ms
206,436 KB
testcase_15 AC 627 ms
206,436 KB
testcase_16 AC 332 ms
229,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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])
0