From da760e0b40c31398c64a0795bbef8403e4c0b6ed Mon Sep 17 00:00:00 2001 From: heerucan Date: Fri, 13 May 2022 01:49:04 +0900 Subject: [PATCH] [BOJ] 1182 (#9) --- BOJ/10872.py | 0 BOJ/1182.py | 21 +++++++++++++++++++++ BOJ/7568.py | 0 3 files changed, 21 insertions(+) create mode 100644 BOJ/10872.py create mode 100644 BOJ/1182.py create mode 100644 BOJ/7568.py diff --git a/BOJ/10872.py b/BOJ/10872.py new file mode 100644 index 0000000..e69de29 diff --git a/BOJ/1182.py b/BOJ/1182.py new file mode 100644 index 0000000..e95ddde --- /dev/null +++ b/BOJ/1182.py @@ -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) + + + + diff --git a/BOJ/7568.py b/BOJ/7568.py new file mode 100644 index 0000000..e69de29