結果
問題 | No.978 Fibonacci Convolution Easy |
ユーザー |
![]() |
提出日時 | 2022-05-19 09:42:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 397 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 82,664 KB |
実行使用メモリ | 202,416 KB |
最終ジャッジ日時 | 2024-09-17 15:10:39 |
合計ジャッジ時間 | 2,868 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 9 |
ソースコード
N, p = map(int, input().split()) a = [0, 1] mod = 10**9+7 if N < 3: res = 0 for i in range(N): for j in range(i+1): res += a[i]*a[j] print(res) else: ss = 1 sm = 1 for i in range(2, N): n = p*a[-1]+a[-2] n %= mod ss += n**2 ss %= mod sm += n sm %= mod a.append(n) print(((sm**2-ss)//2+ss)%mod)