結果
| 問題 |
No.978 Fibonacci Convolution Easy
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-11-28 00:36:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,356 ms / 2,000 ms |
| コード長 | 412 bytes |
| コンパイル時間 | 74 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 167,340 KB |
| 最終ジャッジ日時 | 2024-07-26 21:26:34 |
| 合計ジャッジ時間 | 12,133 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
def main():
N, p = map(int, input().split())
m = 1000000007
a = [0] * max(N + 1, 3)
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)
main()
c-yan