We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b83916 commit 4955a35Copy full SHA for 4955a35
1 file changed
이티예원/15650_N과 M(2).py
@@ -0,0 +1,21 @@
1
+n = int(input())
2
+num = list(range(1, n))
3
+m = int(input())
4
+
5
+'t번째 자리'
6
7
+result=[]
8
+def pick(t):
9
+ for a in range(n-m+1):
10
+ if t != 1 and result != []:
11
+ if result[t-2] < num[t-1+a]:
12
+ result.append(num[t-1+a])
13
+ if t<m:
14
+ pick(t+1)
15
+ elif t == m:
16
+ print (*result, "\n")
17
+ del result[m-1]
18
+ if t >= 2:
19
+ del result[t-2]
20
21
+pick(1)
0 commit comments