第一题:排个序 AC 第二题:暴力36% from copy import copy def miHomeGiftBag(p, M): if not p and M == 0:return 1 if len(p)==1 and M == p[0]:return 1 for i in p: p_ = copy(p);p_.remove(i) if i == M:return 1 if i>M:return 0 if miHomeGiftBag(p_,M-i):return 1 return 0 n = int(input()) p = [int(i) for i in input().split()] p.sort() M = int(input()) print(miHomeGiftBag(p, M))