Koala - 15기/기초 알고리즘 스터디

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

oerreo 2024. 8. 11. 21:52

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

문제

풀이

from itertools import combinations

n, m = map(int, input().split())

arr = [i for i in range(1, n+1)]

for s in combinations(arr, m):
    print(*s)

1. 전 문제인 15649에서 오름차순이라는 조건이 추가

2. 순열-> 조합으로 생각하여 품

저작자표시 (새창열림)