From 0d8e6e56a4dedb9a0a76a0c9e4a66e5fa3071136 Mon Sep 17 00:00:00 2001 From: SSUM <116950962+ssum21@users.noreply.github.com> Date: Fri, 28 Feb 2025 18:05:22 +0900 Subject: [PATCH] =?UTF-8?q?[Silver=20III]=20Title:=20N=EA=B3=BC=20M=20(2),?= =?UTF-8?q?=20Time:=2036=20ms,=20Memory:=2034536=20KB=20-BaekjoonHub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 백준/Silver/15650. N과 M (2)/N과 M (2).py | 13 +++++++ 백준/Silver/15650. N과 M (2)/README.md | 35 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 백준/Silver/15650. N과 M (2)/N과 M (2).py create mode 100644 백준/Silver/15650. N과 M (2)/README.md diff --git a/백준/Silver/15650. N과 M (2)/N과 M (2).py b/백준/Silver/15650. N과 M (2)/N과 M (2).py new file mode 100644 index 0000000..222dcde --- /dev/null +++ b/백준/Silver/15650. N과 M (2)/N과 M (2).py @@ -0,0 +1,13 @@ +import sys +import math +from itertools import combinations + +N, M = map(int, input().split()) + +a=[] + +for i in range(1, N+1): + a.append(i) + +for i in combinations(a, M): + print(*i) \ No newline at end of file diff --git a/백준/Silver/15650. N과 M (2)/README.md b/백준/Silver/15650. N과 M (2)/README.md new file mode 100644 index 0000000..31c353b --- /dev/null +++ b/백준/Silver/15650. N과 M (2)/README.md @@ -0,0 +1,35 @@ +# [Silver III] N과 M (2) - 15650 + +[문제 링크](https://www.acmicpc.net/problem/15650) + +### 성능 요약 + +메모리: 34536 KB, 시간: 36 ms + +### 분류 + +백트래킹 + +### 제출 일자 + +2025년 2월 28일 18:05:11 + +### 문제 설명 + +

자연수 N과 M이 주어졌을 때, 아래 조건을 만족하는 길이가 M인 수열을 모두 구하는 프로그램을 작성하시오.

+ + + +### 입력 + +

첫째 줄에 자연수 N과 M이 주어진다. (1 ≤ M ≤ N ≤ 8)

+ +### 출력 + +

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

+ +

수열은 사전 순으로 증가하는 순서로 출력해야 한다.

+