結果
問題 | No.980 Fibonacci Convolution Hard |
ユーザー |
![]() |
提出日時 | 2020-12-09 18:11:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 507 ms / 2,000 ms |
コード長 | 728 bytes |
コンパイル時間 | 435 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 228,224 KB |
最終ジャッジ日時 | 2024-09-19 01:20:40 |
合計ジャッジ時間 | 10,785 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) p = I() mod = 10**9+7 B = [1,(2*p) % mod,(3*p**2+2) % mod,(4*p**3+6*p) % mod] for _ in range(2*10**6): B.append((2*p*B[-1]-(p**2-2)*B[-2]-2*p*B[-3]-B[-4]) % mod) def f(q): if q <= 3: return 0 return B[q-4] Q = I() for _ in range(Q): print(f(I()))