結果

問題 No.8046 yukicoderの過去問
ユーザー mlihua09
提出日時 2020-08-23 17:00:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 517 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 76,108 KB
最終ジャッジ日時 2024-10-15 18:47:14
合計ジャッジ時間 8,483 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

K = int(input())

N = int(input())

import numpy as np


X = np.array(list(map(int, input().split())))

import sys

sys.setrecursionlimit(10 ** 9)

P = 10 ** 9 + 7

note = np.full(K + 1, -1)
note[0] = 1

def main(x):
    if x < 0:
        
        return 0
    
    if note[x] != -1:
        
        return note[x]
    
    note[x] = 0
    
    for i in X:
        
        if i > x:
            break
        
        note[x] += main(x - i)
        
        note[x] %= P
    
    return note[x]
    
print(main(K))
0