-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.