중복을 허용하면서 조합으로 풀어야한다. 원래의 조합은 중복을 허용하지 않기에 뽑은 숫자 +1 부터 시작하는데 중복조합은 뽑은 숫자 부터 시작해서 중복하도록 만들어 주었다. #### 중복조합 N, M = map(int, input().split()) choice = [0] * M def comb_with_rep(idx, start): if idx == M: print(" ".join(map(str, choice))) return for i in range(start, N): choice[idx] = i+1 comb_with_rep(idx+1, i) comb_with_rep(0, 0)