結果
| 問題 |
No.978 Fibonacci Convolution Easy
|
| ユーザー |
maspy
|
| 提出日時 | 2020-01-31 22:56:11 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 359 bytes |
| コンパイル時間 | 195 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 88,932 KB |
| 最終ジャッジ日時 | 2024-09-17 09:56:21 |
| 合計ジャッジ時間 | 11,833 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 RE * 1 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,p = map(int,readline().split())
MOD = 10 ** 9 + 7
A = [0] * (N+1)
A[2] = 1
for n in range(3,N+1):
A[n] = (A[n-1] * p + A[n-2]) % MOD
S1 = sum(A)
S2 = sum(x**2 for x in A)
S = (S1**2 + S2) % MOD
if S&1:
S += MOD
S //= 2
print(S)
maspy