# -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 문제 출처 : https://bit.ly/2tDZOPF # 홍현이를 포함해서 멤버들의 모든 능력치를 합한 값이 S(목표 점수)가 되는 경우의 수를 출력하라. from itertools import chain, combinations N = input() # 멤버 인원 (5 <= N <= 20) S = input() # 목표 점수 (-10000 <= S <= 10000) H = input() # 홍현이 (-10000 <= H <= 10000) other = list(map(int,(input()).split(' '))) # 각각 멤버들의 능력치 [...N] (-10000 <= N <= 10000) goal = int(S) - int(H) rslt = 0 for i in range(int(N)+1): for c in (combinations(other,i)): if sum(c) is goal: rslt += 1 print(rslt)

https://bit.ly/2tDZOPF


어떤 테스트 케이스를 실패했는지 감이 안옵니다 ㅠㅠ