結果

問題 No.980 Fibonacci Convolution Hard
ユーザー 37zigen37zigen
提出日時 2020-01-31 23:55:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 560 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 81,616 KB
実行使用メモリ 91,304 KB
最終ジャッジ日時 2023-10-17 13:54:03
合計ジャッジ時間 12,665 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 560 ms
91,304 KB
testcase_01 AC 547 ms
91,304 KB
testcase_02 AC 549 ms
91,304 KB
testcase_03 AC 551 ms
91,304 KB
testcase_04 AC 545 ms
91,304 KB
testcase_05 AC 550 ms
91,304 KB
testcase_06 AC 547 ms
91,304 KB
testcase_07 AC 548 ms
91,304 KB
testcase_08 AC 546 ms
91,304 KB
testcase_09 AC 551 ms
91,304 KB
testcase_10 AC 549 ms
91,304 KB
testcase_11 AC 547 ms
91,304 KB
testcase_12 AC 548 ms
91,304 KB
testcase_13 AC 549 ms
91,304 KB
testcase_14 AC 545 ms
91,304 KB
testcase_15 AC 553 ms
91,304 KB
testcase_16 AC 511 ms
91,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M=2000001;
m=10**9+7 ;
p=int(input())
b=[0]*M
b[4]=1
x=p*p%m
for i in range(5,M) : 
    b[i]=(2*p*b[i-1]+(2-x)*b[i-2]-2*p*b[i-3]-b[i-4])%m
q = int(input())
for i in range(q) : 
    x = int(input())
    print((b[x]+m)%m)
0