주제무 다시 봐도 핵심만 보이게끔!

  • 홈
  • 태그
  • 방명록
  • 전체 (95)
    • 알고리즘 (23)
      • 데일리 (0)
      • 그래프 (0)
      • 다이나믹 프로그래밍 (0)
      • 기타 (0)
    • 컴퓨터과학 (26)
    • AWS (13)
    • 자바 (5)
    • 프로젝트 (11)
    • 스프링 (11)
    • 시스템 구조 (2)
    • 방탈출 (4)

조합 1

순열과 조합을 구현해보자

순열과 조합 backtracking 을 이용한 조합 n, m = map(int, input().split()) data = [] def combination(pre_num): if len(data) == m: print(*data) else: for i in range(1, n+1): if pre_num < i: data.append(i) combination(i) data.pop() combination(0) 순열 n, m = map(int, input().split()) data = [] def permutation(pre_list): if len(data) == m: print(*data) else: for i in range(1, n+1): if i not in pre_list: data.appe..

알고리즘 2024.01.08
이전
1
다음
더보기

Copyright © Kakao Corp. All rights reserved.

티스토리툴바