Skip to content

Commit f857ba8

Browse files
committed
#2 : 15650_N과 M(2)
1 parent 79b802e commit f857ba8

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

이티준희/15650_N과 M(2).py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
수열은 사전 순으로 증가하는 순서로 출력해야 한다.
1414
1515
'''
16-
import itertools
1716

18-
n,m = map(int,input().split())
1917

18+
'''
19+
#feedback ) combinations 만 사용해도 풀이 가능
20+
from itertools
21+
n,m = map(int,input().split())
2022
num = itertools.combinations([i for i in range(1,n+1)],m)
2123
2224
for i in num :
@@ -26,4 +28,18 @@
2628
print(" ".join(map(str, k)))
2729
#map k의 요소들을 문자열로 반환
2830
#join 리스트 요소를 문자열로 연결
29-
#" "로 요소 사이에 구분자
31+
#" "로 요소 사이에 구분자
32+
'''
33+
from itertools import combinations
34+
35+
n,m = map(int,input().split())
36+
37+
arr = []
38+
for i in range(1,n+1):
39+
arr.append(i)
40+
41+
for i in combinations(arr,m):
42+
for j in i:
43+
print(j, end=' ')
44+
print()
45+

0 commit comments

Comments
 (0)