結果

問題 No.3046 White Tiger vs Monster
ユーザー lam6er
提出日時 2025-04-16 15:56:07
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 443 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 81,932 KB
実行使用メモリ 67,052 KB
最終ジャッジ日時 2025-04-16 15:58:36
合計ジャッジ時間 7,889 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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