Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions week24/BOJ_16938/캠프 준비_홍지훈.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys, itertools
input = sys.stdin.readline

N, L, R, X = map(int, input().rstrip().split()) # N: 문제의 수, L <= 문제 난이도의 합 <= R, 가장 어려운 문제 - 가장 쉬운 문제 난이도 차이 >= X
difficulty = list(map(int, input().rstrip().split()))
result = 0

for n in range(2, N + 1):
cases = list(itertools.combinations(difficulty, n))

for problems in cases:
min_prob = min(problems)
max_prob = max(problems)
if R >= sum(problems) >= L and max_prob - min_prob >= X:
result += 1

print(result)