Skip to content

Commit

Permalink
[BOJ] 1182 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
heerucan committed May 12, 2022
1 parent 942b974 commit da760e0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Empty file added BOJ/10872.py
Empty file.
21 changes: 21 additions & 0 deletions BOJ/1182.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 백준 1182 실버3
# 부분수열의 합
# 브루트포스 알고리즘, 백트래킹

from itertools import combinations

n, s = map(int, input().split(' '))
data = list(map(int, input().split(' ')))
count = 0

for i in range(1, n+1):
for j in combinations(data, i):
# print("순열들: ", j, " / 합 = ", sum(j))
if sum(j) == s:
count += 1

print(count)




Empty file added BOJ/7568.py
Empty file.

0 comments on commit da760e0

Please sign in to comment.