알고리즘/백준

[백준 알고리즘] 15649번: N과 M(1) (Python / 파이썬)

gyujh 2024. 1. 24. 23:29
정답 코드
#15649번: N과 M(1)

import sys

def find_sequence(select):
    if len(select) == m:
        print(*select)
    for i in range(1, n+1):
        if i not in select:
            select.append(i)
            find_sequence(select)
            select.pop()
    return

n, m = map(int, sys.stdin.readline().split())

find_sequence([])

 

15649번: N과 M (1)

한 줄에 하나씩 문제의 조건을 만족하는 수열을 출력한다. 중복되는 수열을 여러 번 출력하면 안되며, 각 수열은 공백으로 구분해서 출력해야 한다. 수열은 사전 순으로 증가하는 순서로 출력해

www.acmicpc.net