結果
| 問題 |
No.980 Fibonacci Convolution Hard
|
| ユーザー |
tempura_pp
|
| 提出日時 | 2020-01-30 02:46:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 616 ms / 2,000 ms |
| コード長 | 339 bytes |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 82,000 KB |
| 実行使用メモリ | 107,836 KB |
| 最終ジャッジ日時 | 2024-09-17 11:24:37 |
| 合計ジャッジ時間 | 11,870 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
def solve():
M = 2000001
mod = 10**9+7
p = int(input())
ans = [0]*M
a = [0]*M
a[2] = 1
for i in range(3,M) :
ans[i] = (p * ans[i-1] + ans[i-2] + a[i-2]) % mod
a[i] = (p * a[i-1] + a[i-2]) % mod
q = int(input())
for i in range(q) :
x = int(input())
print(ans[x])
solve()
tempura_pp