L3-001 凑零钱
L3-001 凑零钱 - 团体程序设计天梯赛-练习集
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
f = [[] for _ in range(m + 1)]
f[0] = [0]
for i in a:for j in range(m, i - 1, -1):if f[j - i]:if not f[j] or f[j] > f[j - i] + [i]:f[j] = f[j - i] + [i]else:f[j] = f[j]
if not f[m]:print("No Solution")
else:print(*f[m][1:])