from itertools import combinations 코드를 입력하여 조합 라이브러리를 사용했다.
from itertools import combinations
TC = int(input())
for tc in range(1,TC+1):
N,K = map(int,input().split())
arr=[i+1 for i in range(12)]
com=list(combinations(arr, N))
cnt=0
for i in com:
if sum(i)==K:
cnt+=1
print(f'#{tc} {cnt}')
combinations(조합) 라이브러리와 세트로 등장하는 permutations(순열) 라이브러리의 차이에 대해 설명하자면:
해당 풀이에서 그랬듯이 조합 라이브러리는 순서가 달라도 동일한 원소로 이루어져 있다면 같은 조합으로 취급하나,
순열 라이브러리는 동일한 원소라도 순서가 다르다면 다른 순열로 취급한다.
예를 들어 조합 라이브러리의 경우 (1,2)가 있다면 (2,1)은 생성하지 않지만
순열 라이브러리는 (1,2)와 (2,1) 모두 생성한다.