結果

問題 No.1238 選抜クラス
ユーザー 👑 Kazun
提出日時 2021-05-21 01:22:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 76,596 KB
最終ジャッジ日時 2024-10-10 07:25:41
合計ジャッジ時間 3,227 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N,K=map(int,input().split())
M=100*N
A=list(map(lambda x:int(x)-K,input().split()))

Mod=10**9+7
D=defaultdict(int)
D[0]=1

for i in range(1,N+1):
    E=D.copy()

    a=A[i-1]

    for x in E:
        D[x+a]+=E[x]
        D[x+a]%=Mod

X=0
for k in D:
    if k>=0: X+=D[k]

print((X-1)%Mod)
0