結果

問題 No.3046 yukicoderの過去問
ユーザー tcltktcltk
提出日時 2021-01-16 07:17:59
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 782 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 101,736 KB
最終ジャッジ日時 2023-08-18 03:43:37
合計ジャッジ時間 5,917 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 230 ms
87,852 KB
testcase_01 AC 236 ms
83,460 KB
testcase_02 AC 232 ms
83,344 KB
testcase_03 AC 247 ms
86,840 KB
testcase_04 AC 232 ms
83,424 KB
testcase_05 AC 237 ms
85,148 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """4
# 2
# 1 3
# """
# sys.stdin = io.StringIO(_INPUT)

MOD = 1000000007

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

    dp = [0 for _ in range(K+1)]
    dp[0] = 1
    for i in range(1, K+1):
        for j in range(N):
            if x[j] > i:
                break
            dp[i] = (dp[i] + dp[i-x[j]]) % MOD
    print(dp[K] % MOD)

if __name__ == '__main__':
    main()
0