結果

問題 No.980 Fibonacci Convolution Hard
ユーザー ayaoniayaoni
提出日時 2020-12-09 18:18:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,350 ms / 2,000 ms
コード長 298 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,616 KB
実行使用メモリ 227,104 KB
最終ジャッジ日時 2023-10-19 05:04:31
合計ジャッジ時間 19,771 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,350 ms
206,136 KB
testcase_01 AC 896 ms
206,024 KB
testcase_02 AC 905 ms
206,080 KB
testcase_03 AC 899 ms
206,076 KB
testcase_04 AC 915 ms
206,076 KB
testcase_05 AC 977 ms
206,092 KB
testcase_06 AC 892 ms
206,088 KB
testcase_07 AC 905 ms
206,092 KB
testcase_08 AC 928 ms
206,088 KB
testcase_09 AC 915 ms
206,088 KB
testcase_10 AC 879 ms
206,084 KB
testcase_11 AC 918 ms
205,948 KB
testcase_12 AC 904 ms
206,080 KB
testcase_13 AC 882 ms
206,084 KB
testcase_14 AC 887 ms
206,080 KB
testcase_15 AC 892 ms
206,004 KB
testcase_16 AC 613 ms
227,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p = int(input())
mod = 10**9+7

B = [1,(2*p) % mod,(3*p**2+2) % mod,(4*p**3+6*p) % mod]
for _ in range(2*10**6):
    B.append((2*p*B[-1]-(p**2-2)*B[-2]-2*p*B[-3]-B[-4]) % mod)

Q = int(input())
for _ in range(Q):
    q = int(input())
    if q <= 3:
        print(0)
    else:
        print(B[q-4])
0