일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- lcm
- LCS
- 매일11시
- 뒤로가기
- itertools
- 파이썬
- 코틀린
- permutation
- 11053
- 11057
- 11054
- Python
- 코테
- 괄호
- 안드로이드
- 앱
- Kotlin
- 백준
- Android
- 1182
- 최소공배수
- 홈화면
- 6603
- 11기
- expo
- Combination
- 나머지
- 9095
- 1260
- 순열
Archives
- Today
- Total
황소개발자
백준 15663 파이썬 python : N과 M (9) @@황소처럼 우직하게@@ 본문
반응형
n, m = map(int, input().split())
num_list = list(map(int, input().split()))
num_list.sort()
a = [0 for i in range(m)]
c = [False for i in range(n)]
ans = []
def go(idx, n, m):
if idx == m:
ans.append(a.copy())
return
for i in range(n):
if c[i] == False:
c[i] = True
a[idx] = num_list[i]
go(idx + 1, n, m)
c[i] = False
go(0, n, m)
ans.sort()
print(' '.join(map(str, ans[0])))
for i in range(1, len(ans)):
if ans[i - 1] != ans[i]:
print(' '.join(map(str, ans[i])))
반응형
'백준 문제 풀이' 카테고리의 다른 글
백준 15665 파이썬 python : N과 M (11) @@황소처럼 우직하게@@ (0) | 2020.03.02 |
---|---|
백준 15664 파이썬 python : N과 M (10) @@황소처럼 우직하게@@ 시간초과 안나넹 (0) | 2020.03.02 |
백준 15657 파이썬 python : N과 M (8) @@황소처럼 우직하게@@ (0) | 2020.03.02 |
백준 15656 파이썬 python : N과 M (7) @@황소처럼 우직하게@@ (0) | 2020.03.02 |
백준 15655 파이썬 python : N과 M (6) @@황소처럼 우직하게@@ (0) | 2020.03.02 |
Comments