結果

問題 No.978 Fibonacci Convolution Easy
ユーザー tyawanmusityawanmusi
提出日時 2020-01-31 21:40:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 178 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 11,752 KB
実行使用メモリ 10,088 KB
最終ジャッジ日時 2023-10-17 09:01:05
合計ジャッジ時間 16,319 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
10,088 KB
testcase_01 AC 761 ms
10,088 KB
testcase_02 AC 367 ms
10,088 KB
testcase_03 AC 1,698 ms
10,088 KB
testcase_04 AC 471 ms
10,088 KB
testcase_05 AC 122 ms
10,088 KB
testcase_06 AC 625 ms
10,088 KB
testcase_07 AC 1,126 ms
10,088 KB
testcase_08 AC 771 ms
10,088 KB
testcase_09 AC 1,259 ms
10,088 KB
testcase_10 AC 1,909 ms
10,088 KB
testcase_11 AC 525 ms
10,088 KB
testcase_12 AC 109 ms
10,088 KB
testcase_13 AC 608 ms
10,088 KB
testcase_14 AC 195 ms
10,088 KB
testcase_15 AC 685 ms
10,088 KB
testcase_16 AC 1,865 ms
10,088 KB
testcase_17 AC 1,808 ms
10,088 KB
testcase_18 WA -
testcase_19 AC 28 ms
10,088 KB
testcase_20 AC 28 ms
10,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
n,p=map(int,input().split())
if n==1:print(0)
s=1
a0,a1=0,1
ans=1
for i in range(2,n):
  a0,a1=a1,a0+p*a1
  a1%=mod
  s+=a1
  s%=mod
  ans+=s*a1
  ans%=mod
print(ans)
0