-
백준(BaekJoon)_15649_N과M(1)Algorithm/Problems_Solving 2022. 8. 21. 11:33
result = [] def func(n,m): if len(result) == m: for i in result: print(i, end=" ") print() return else: for i in range(1,n+1): if i not in result: result.append(i) func(n,m) result.pop() n, m = map(int, input().split()) func(n,m) ================================================ cf. 같은 결과를 낸다 if len(result) == m: for i in result: print(i, end=" ") print() if len(result)==m: print(' '.join(map(str,result))) return # 출처: https://jiwon-coding.tistory.com/
'Algorithm > Problems_Solving' 카테고리의 다른 글
백준(BaekJoon)_15654_N과M(5) (0) 2022.08.23 백준(BaekJoon)_15652_N과M(4) (0) 2022.08.23 백준(BaekJoon)_15651_N과M(3) (0) 2022.08.21 백준(BaekJoon)_15650_N과 M(2) (0) 2022.08.21 백준(BaekJoon)_9506_약수들의합 (0) 2022.08.20