結果

問題 No.978 Fibonacci Convolution Easy
ユーザー titiatitia
提出日時 2020-01-31 21:42:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 201 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 11,824 KB
実行使用メモリ 88,616 KB
最終ジャッジ日時 2023-10-17 09:05:22
合計ジャッジ時間 18,408 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
10,928 KB
testcase_01 AC 817 ms
40,688 KB
testcase_02 AC 435 ms
25,584 KB
testcase_03 TLE -
testcase_04 AC 539 ms
29,296 KB
testcase_05 AC 140 ms
14,192 KB
testcase_06 AC 716 ms
36,520 KB
testcase_07 AC 1,362 ms
58,848 KB
testcase_08 AC 926 ms
43,748 KB
testcase_09 AC 1,463 ms
66,072 KB
testcase_10 TLE -
testcase_11 AC 614 ms
32,356 KB
testcase_12 AC 124 ms
13,744 KB
testcase_13 AC 703 ms
36,064 KB
testcase_14 AC 219 ms
17,452 KB
testcase_15 AC 792 ms
39,776 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 28 ms
10,100 KB
testcase_19 AC 29 ms
10,100 KB
testcase_20 AC 29 ms
10,100 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