結果

問題 No.980 Fibonacci Convolution Hard
ユーザー Eki1009Eki1009
提出日時 2020-11-01 18:23:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,078 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 126,116 KB
最終ジャッジ日時 2023-09-29 11:20:30
合計ジャッジ時間 21,066 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,022 ms
126,116 KB
testcase_01 AC 1,047 ms
125,768 KB
testcase_02 AC 1,057 ms
125,792 KB
testcase_03 AC 1,071 ms
125,792 KB
testcase_04 AC 1,054 ms
125,788 KB
testcase_05 AC 1,037 ms
126,000 KB
testcase_06 AC 1,034 ms
126,048 KB
testcase_07 AC 1,039 ms
125,968 KB
testcase_08 AC 1,066 ms
125,972 KB
testcase_09 AC 1,055 ms
125,944 KB
testcase_10 AC 1,052 ms
125,764 KB
testcase_11 AC 1,078 ms
125,968 KB
testcase_12 AC 1,046 ms
126,016 KB
testcase_13 AC 1,037 ms
125,728 KB
testcase_14 AC 1,047 ms
126,060 KB
testcase_15 AC 1,052 ms
125,968 KB
testcase_16 AC 523 ms
93,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9+7
m = 2*10**6
p = int(input())
C = [2*p, 2-p**2, -2*p, -1]
E = [0]*(m+1)
E[3] = 1
for i in range(4, m+1):
    E[i] = C[0]*E[i-1] + C[1]*E[i-2] + C[2]*E[i-3] + C[3]*E[i-4]
    E[i] %= mod
q = int(input())
for _ in range(q):
    n = int(input())
    print(E[n-1])
0