hibiscus

  • 홈
  • 태그
  • 방명록

15654 1

[백준 알고리즘] 15654.N과 M (5) - 순열

중복되지 않은 순열을 풀때는 방문 표시가 필수! #### 순열 N, M = map(int, input().split()) num = list(map(int, input().split())) num.sort() visited = [0] * N choice = [0] * M def perm(idx): if idx == M: print(" ".join(map(str, choice))) return for i in range(N): if visited[i] == 0: choice[idx] = num[i] visited[i] = 1 perm(idx+1) visited[i] = 0 perm(0)

알고리즘 문제 풀기/백준(Baekjoon) 2021.03.20
이전
1
다음
더보기
프로필사진

hibiscus

  • 분류 전체보기 (71)
    • 차곡차곡 자바스크립트 (0)
    • Project (0)
    • Web (2)
    • CS (1)
    • 알고리즘 문제 풀기 (61)
      • 백준(Baekjoon) (47)
      • 프로그래머스 (0)
      • SWEA (12)
      • 알고리즘 정리 (2)
    • Error (1)
    • 면접후기 (1)

Tag

다익스트라, 백준, 회문, 5427, 인수의생일파티, 2479, 4839, 영역구하기, 순열, SWEA, 브루트포스, 알고리즘, 2806, react, 1283, DFS, 조합, 1795, 파이썬, N과M,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/10   »
일 월 화 수 목 금 토
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바