[백준] 18429번 근손실 _ 문제 풀이



1. 문제

https://www.acmicpc.net/problem/18429

2. 풀이

from itertools import permutations

N, K = map(int, input().split())
exer = list(map(int, input().split()))
answer = 0

for permu in list(permutations(exer, N)):
    val = 0
    for x in permu:
        val += x - K
        if val < 0:
            break
    if val >= 0:
        answer += 1
        
print(answer)