結果

問題 No.978 Fibonacci Convolution Easy
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-09-30 22:06:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 216 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 86,620 KB
最終ジャッジ日時 2023-09-20 17:52:35
合計ジャッジ時間 10,274 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
8,976 KB
testcase_01 AC 394 ms
38,756 KB
testcase_02 AC 209 ms
23,572 KB
testcase_03 AC 966 ms
83,296 KB
testcase_04 AC 253 ms
27,284 KB
testcase_05 AC 66 ms
12,108 KB
testcase_06 AC 341 ms
34,516 KB
testcase_07 AC 618 ms
56,844 KB
testcase_08 AC 432 ms
41,756 KB
testcase_09 AC 707 ms
63,992 KB
testcase_10 AC 991 ms
86,392 KB
testcase_11 AC 295 ms
30,368 KB
testcase_12 AC 60 ms
11,868 KB
testcase_13 AC 339 ms
34,056 KB
testcase_14 AC 106 ms
15,432 KB
testcase_15 AC 386 ms
37,792 KB
testcase_16 AC 980 ms
86,620 KB
testcase_17 AC 979 ms
86,228 KB
testcase_18 WA -
testcase_19 AC 15 ms
7,784 KB
testcase_20 AC 15 ms
7,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p = map(int, input().split())
fib = [0, 1]
for i in range(n - 2):
    fib.append((fib[-1] * p + fib[-2]) % (10 ** 9 + 7))
cnt = 0
for i in fib:
    cnt += i ** 2
print(((sum(fib) ** 2 + cnt) // 2) % (10 ** 9 + 7))
0