結果

問題 No.978 Fibonacci Convolution Easy
ユーザー AEnAEn
提出日時 2022-05-19 09:51:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 200,260 KB
最終ジャッジ日時 2023-10-17 18:03:24
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
60,256 KB
testcase_01 AC 87 ms
113,852 KB
testcase_02 AC 69 ms
89,092 KB
testcase_03 AC 142 ms
199,616 KB
testcase_04 AC 71 ms
93,132 KB
testcase_05 AC 48 ms
66,080 KB
testcase_06 AC 81 ms
107,564 KB
testcase_07 AC 106 ms
147,112 KB
testcase_08 AC 90 ms
120,596 KB
testcase_09 AC 117 ms
169,340 KB
testcase_10 AC 136 ms
200,228 KB
testcase_11 AC 77 ms
101,884 KB
testcase_12 AC 48 ms
65,256 KB
testcase_13 AC 80 ms
107,556 KB
testcase_14 AC 54 ms
72,056 KB
testcase_15 AC 83 ms
113,668 KB
testcase_16 AC 137 ms
200,260 KB
testcase_17 AC 136 ms
200,208 KB
testcase_18 AC 36 ms
53,516 KB
testcase_19 AC 36 ms
53,516 KB
testcase_20 AC 36 ms
53,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, p = map(int, input().split())
a = [0, 1]
mod = 10**9+7
for i in range(2, N):
    a.append((p*a[-1]+a[-2])%mod)
s = 0
res = 0
for i in range(N):
    s += a[i]
    s %= mod
    res += s*a[i]
    res %= mod
print(res)
0