개발/Algorithm

[Python] 백준 15650번 N과 M (2)

Dane.Kim 2021. 11. 15.

from itertools import combinations 

N, M = map(int, input().split()) 

p = combinations(range(1, N+1), M) 

for i in p: 
    print(i)

중복이 안되므로 combinations으로 풀어 준다.

댓글