From e1aa4fef62a2ed82486b7b15ffbf75a5ea98958d Mon Sep 17 00:00:00 2001 From: SSUM <116950962+ssum21@users.noreply.github.com> Date: Sat, 1 Mar 2025 21:25:06 +0900 Subject: [PATCH] =?UTF-8?q?[Silver=20II]=20Title:=20N=EA=B3=BC=20M=20(9),?= =?UTF-8?q?=20Time:=20104=20ms,=20Memory:=2039152=20KB=20-BaekjoonHub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 백준/Silver/15663. N과 M (9)/N과 M (9).py | 19 ++++++++++ 백준/Silver/15663. N과 M (9)/README.md | 36 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 백준/Silver/15663. N과 M (9)/N과 M (9).py create mode 100644 백준/Silver/15663. N과 M (9)/README.md diff --git a/백준/Silver/15663. N과 M (9)/N과 M (9).py b/백준/Silver/15663. N과 M (9)/N과 M (9).py new file mode 100644 index 0000000..46e6f46 --- /dev/null +++ b/백준/Silver/15663. N과 M (9)/N과 M (9).py @@ -0,0 +1,19 @@ +from itertools import combinations +import sys +from itertools import permutations +from itertools import product +import math + +input = sys.stdin.readline + +result = set() +n, m = map(int, input().split()) +a = list(map(int,input().split())) +a = sorted(a) +for i in permutations(a, m): + result.add((i)) + +result = sorted(result) + +for i in result: + print(*i) \ No newline at end of file diff --git a/백준/Silver/15663. N과 M (9)/README.md b/백준/Silver/15663. N과 M (9)/README.md new file mode 100644 index 0000000..092db9a --- /dev/null +++ b/백준/Silver/15663. N과 M (9)/README.md @@ -0,0 +1,36 @@ +# [Silver II] N과 M (9) - 15663 + +[문제 링크](https://www.acmicpc.net/problem/15663) + +### 성능 요약 + +메모리: 39152 KB, 시간: 104 ms + +### 분류 + +백트래킹 + +### 제출 일자 + +2025년 3월 1일 21:24:53 + +### 문제 설명 + +

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

+ + + +### 입력 + +

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

+ +

둘째 줄에 N개의 수가 주어진다. 입력으로 주어지는 수는 10,000보다 작거나 같은 자연수이다.

+ +### 출력 + +

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

+ +

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

+