結果

問題 No.980 Fibonacci Convolution Hard
ユーザー 37zigen37zigen
提出日時 2020-01-31 22:38:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 831 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 1,730 ms
コンパイル使用メモリ 81,412 KB
実行使用メモリ 91,448 KB
最終ジャッジ日時 2023-10-17 11:05:37
合計ジャッジ時間 17,834 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 822 ms
91,444 KB
testcase_01 AC 831 ms
91,444 KB
testcase_02 AC 825 ms
91,432 KB
testcase_03 AC 824 ms
91,444 KB
testcase_04 AC 823 ms
91,448 KB
testcase_05 AC 821 ms
91,440 KB
testcase_06 AC 815 ms
91,440 KB
testcase_07 AC 819 ms
91,444 KB
testcase_08 AC 813 ms
91,440 KB
testcase_09 AC 815 ms
91,440 KB
testcase_10 AC 829 ms
91,444 KB
testcase_11 AC 820 ms
91,440 KB
testcase_12 AC 820 ms
91,440 KB
testcase_13 AC 814 ms
91,436 KB
testcase_14 AC 814 ms
91,440 KB
testcase_15 AC 822 ms
91,440 KB
testcase_16 AC 509 ms
91,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M = 2000001;
m = 10**9+7 ;
p = int(input())
b = [0]*M
b[4] = 1
for i in range(5,M) : 
    b[i]=(2*p*b[i-1]+(2-p*p)*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