結果
| 問題 |
No.978 Fibonacci Convolution Easy
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-11-28 00:32:23 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 359 bytes |
| コンパイル時間 | 143 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 167,400 KB |
| 最終ジャッジ日時 | 2024-07-26 21:25:20 |
| 合計ジャッジ時間 | 22,459 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 RE * 1 TLE * 4 |
ソースコード
from itertools import accumulate
N, p = map(int, input().split())
m = 1000000007
a = [0] * (N + 1)
a[1] = 0
a[2] = 1
for i in range(3, N + 1):
a[i] = (p * a[i - 1] + a[i - 2]) % m
c = [0] * (N + 1)
for i in range(1, N + 1):
c[i] = (c[i - 1] + a[i]) % m
result = 0
for i in range(1, N + 1):
result += a[i] * c[i]
result %= m
print(result)
c-yan