結果

問題 No.997 Jumping Kangaroo
ユーザー chinchillachinchilla
提出日時 2020-02-23 01:03:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 574 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,468 KB
最終ジャッジ日時 2024-10-10 01:17:39
合計ジャッジ時間 18,415 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
md = 1000000007
n, w, k = map(int, input().split())
A = list(map(int, input().split()))
L = [1]+[0]*(w*2)
for i in range(1, w*2+1):
    L[i] = sum(L[i-a] for a in A)
g1 = L[w] % md
g2 = (L[w*2] - L[w]**2) % md
m = np.matrix([[g1, g2], [1, 0]], dtype=int)
p = np.matrix(np.identity(2), dtype=int)
while k:
    if k%2: p *= m; p %= md
    m *= m; m %= md
    k //= 2
print(p[0, 0])
0