結果

問題 No.978 Fibonacci Convolution Easy
ユーザー titiatitia
提出日時 2020-01-31 21:42:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 201 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 81,640 KB
実行使用メモリ 199,972 KB
最終ジャッジ日時 2023-10-19 00:59:22
合計ジャッジ時間 2,941 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
59,968 KB
testcase_01 AC 88 ms
113,564 KB
testcase_02 AC 69 ms
88,804 KB
testcase_03 AC 140 ms
199,328 KB
testcase_04 AC 71 ms
92,844 KB
testcase_05 AC 49 ms
65,792 KB
testcase_06 AC 81 ms
107,276 KB
testcase_07 AC 106 ms
146,824 KB
testcase_08 AC 91 ms
120,308 KB
testcase_09 AC 118 ms
169,052 KB
testcase_10 AC 139 ms
199,940 KB
testcase_11 AC 78 ms
101,596 KB
testcase_12 AC 49 ms
64,968 KB
testcase_13 AC 81 ms
107,268 KB
testcase_14 AC 54 ms
71,768 KB
testcase_15 AC 84 ms
113,380 KB
testcase_16 AC 137 ms
199,972 KB
testcase_17 AC 137 ms
199,920 KB
testcase_18 AC 39 ms
53,260 KB
testcase_19 AC 38 ms
53,260 KB
testcase_20 AC 38 ms
53,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,p=map(int,input().split())
mod=1000000007

A=[0,1]
for i in range(N-2):
    A.append((A[-1]*p+A[-2])%mod)

S=0
ANS=0
for i in range(N):
    S+=A[i]
    ANS+=S*A[i]
    S%=mod
    ANS%=mod

print(ANS)
0