(수학) 백준 하위 수열의 합 1182 with Python

https://www.acmicpc.net/problem/1182 n, s = map(int, input().split()) lst = list(map(int, input().split())) pair = () cnt = 0 def btracking(start): global cnt if sum(pair) == s and len(pair) > 0: cnt += 1 for i in range(start, n): pair.append(lst(i)) btracking(i + 1) pair.pop() btracking(0) print(cnt) 저번에 풀었던 n과 m과 달리 (1, 3)과 (3, 1)이 같으므로 중복을 허용하지 … Read more