結果

問題 No.978 Fibonacci Convolution Easy
ユーザー r_ishidar_ishida
提出日時 2020-02-01 18:19:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 207 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 11,844 KB
実行使用メモリ 88,560 KB
最終ジャッジ日時 2023-10-19 00:11:48
合計ジャッジ時間 9,693 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
10,928 KB
testcase_01 AC 427 ms
40,688 KB
testcase_02 AC 229 ms
25,584 KB
testcase_03 AC 988 ms
85,340 KB
testcase_04 AC 274 ms
29,296 KB
testcase_05 AC 83 ms
14,192 KB
testcase_06 AC 376 ms
36,520 KB
testcase_07 AC 654 ms
58,848 KB
testcase_08 AC 455 ms
43,748 KB
testcase_09 AC 746 ms
66,072 KB
testcase_10 AC 1,030 ms
88,400 KB
testcase_11 AC 319 ms
32,356 KB
testcase_12 AC 77 ms
13,744 KB
testcase_13 AC 365 ms
36,064 KB
testcase_14 AC 122 ms
17,452 KB
testcase_15 AC 402 ms
39,776 KB
testcase_16 AC 1,020 ms
88,560 KB
testcase_17 AC 1,026 ms
88,308 KB
testcase_18 WA -
testcase_19 AC 30 ms
10,100 KB
testcase_20 AC 29 ms
10,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p = map(int,input().split())
MOD = 10**9+7
a = [0, 1]
for i in range(n-2):
    a.append((a[i+1]*p+a[i])%MOD)
s = sum(i**2 for i in a)
ans = (pow(sum(a), 2, MOD)+s)*pow(2, MOD-2, MOD)
ans %= MOD
print(ans)
0