We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79b802e commit f857ba8Copy full SHA for f857ba8
1 file changed
이티준희/15650_N과 M(2).py
@@ -13,10 +13,12 @@
13
수열은 사전 순으로 증가하는 순서로 출력해야 한다.
14
15
'''
16
-import itertools
17
18
-n,m = map(int,input().split())
19
+'''
+#feedback ) combinations 만 사용해도 풀이 가능
20
+from itertools
21
+n,m = map(int,input().split())
22
num = itertools.combinations([i for i in range(1,n+1)],m)
23
24
for i in num :
@@ -26,4 +28,18 @@
26
28
print(" ".join(map(str, k)))
27
29
#map k의 요소들을 문자열로 반환
30
#join 리스트 요소를 문자열로 연결
- #" "로 요소 사이에 구분자
31
+ #" "로 요소 사이에 구분자
32
33
+from itertools import combinations
34
+
35
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