結果

問題 No.3046 White Tiger vs Monster
ユーザー lam6er
提出日時 2025-04-15 22:52:10
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 443 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 82,008 KB
実行使用メモリ 66,852 KB
最終ジャッジ日時 2025-04-15 22:54:36
合計ジャッジ時間 8,011 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 80
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7

K = int(input())
N = int(input())
x = list(map(int, input().split()))

# Filter out steps larger than K and sort them
x = [xi for xi in x if xi <= K]
x.sort()

dp = [0] * (K + 1)
dp[0] = 1  # Base case: one way to stay at 0 steps

for k in range(1, K + 1):
    for xi in x:
        if xi > k:
            break  # Since x is sorted, no need to check further
        dp[k] += dp[k - xi]
        dp[k] %= MOD

print(dp[K] % MOD)
0