結果

問題 No.1238 選抜クラス
ユーザー toyuzukotoyuzuko
提出日時 2020-09-28 23:51:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 92,828 KB
最終ジャッジ日時 2023-09-15 18:42:50
合計ジャッジ時間 6,192 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
76,880 KB
testcase_01 AC 86 ms
77,056 KB
testcase_02 AC 90 ms
77,992 KB
testcase_03 AC 81 ms
76,652 KB
testcase_04 AC 79 ms
76,632 KB
testcase_05 AC 79 ms
76,548 KB
testcase_06 AC 79 ms
76,632 KB
testcase_07 AC 87 ms
77,412 KB
testcase_08 AC 89 ms
77,992 KB
testcase_09 AC 95 ms
79,532 KB
testcase_10 AC 92 ms
78,108 KB
testcase_11 AC 94 ms
78,864 KB
testcase_12 AC 95 ms
78,696 KB
testcase_13 AC 92 ms
78,832 KB
testcase_14 AC 90 ms
77,992 KB
testcase_15 AC 93 ms
78,796 KB
testcase_16 AC 95 ms
79,156 KB
testcase_17 AC 141 ms
92,828 KB
testcase_18 AC 147 ms
92,240 KB
testcase_19 AC 140 ms
92,336 KB
testcase_20 AC 139 ms
92,004 KB
testcase_21 AC 137 ms
91,468 KB
testcase_22 AC 135 ms
92,280 KB
testcase_23 AC 142 ms
92,732 KB
testcase_24 AC 141 ms
92,572 KB
testcase_25 AC 135 ms
92,104 KB
testcase_26 AC 143 ms
92,784 KB
testcase_27 AC 140 ms
92,780 KB
testcase_28 AC 144 ms
92,508 KB
testcase_29 AC 144 ms
92,416 KB
testcase_30 AC 105 ms
81,844 KB
testcase_31 AC 121 ms
85,744 KB
testcase_32 AC 129 ms
89,120 KB
testcase_33 AC 90 ms
77,544 KB
testcase_34 AC 138 ms
90,532 KB
testcase_35 AC 114 ms
83,092 KB
testcase_36 AC 101 ms
79,960 KB
testcase_37 AC 107 ms
82,104 KB
testcase_38 AC 149 ms
92,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 1000000007

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

B = [A[i] - K for i in range(N)]

dp = [[0 for j in range(20001)] for i in range(N + 1)]
dp[0][0] = 1

for i in range(1, N + 1):
    for j in range(-10000, 10001):
        if -10000 <= j - B[i - 1] <= 10000:
            dp[i][j] += dp[i - 1][j - B[i - 1]] + dp[i - 1][j]
            dp[i][j] %= MOD

res = 0

for j in range(0, 10001):
    res += dp[N][j]
    res %= MOD

print(res - 1)
0