티스토리 뷰
import sys
from itertools import combinations
n, s = map(int, sys.stdin.readline().split())
num = list(map(int, sys.stdin.readline().split()))
answer = 0
for i in range(1, n+1):
com = list(combinations(num, i))
for c in com:
if sum(c) == s:
answer += 1
print(answer)
'Algorithm > Baekjoon' 카테고리의 다른 글
[백준] 1181 : 단어 정렬 - Python (0) | 2021.03.31 |
---|---|
[백준] 2960 : 에라토스테네스의 체 - Python (0) | 2021.02.26 |
[백준] 12865 : 평범한 배낭 - Python (0) | 2021.02.23 |
[백준] 2468 : 안전 영역 - Python (0) | 2021.02.20 |
[백준] 1012 : 유기농 배추 - Python (0) | 2021.02.18 |