일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- BFS
- 코딩테스트
- 파이썬
- programmers
- Queue
- level4
- lv4
- sql
- python
- mysql
- CodingTest
- coding test
- itertools
- counter
- import re
- join
- Stack
- 코딩
- 프로그래머스
- 시간복잡도
- coding
- 조합
- Level2
- collections
- 데이터분석
- time complexity
- lambda
- 연습문제
- 코테
- 완전탐색
- Today
- Total
목록Permutations (2)
ror_coding
from itertools importpermutations (순열)combinations (조합)product (주어진 반복 가능한 객체(iterable)들로 만들 수 있는 모든 조합 반환)cycle from itertools import permutations as perm # 순열from itertools import combinations as comb # 조합from itertools import product # 모든 가능한 조합from itertools import cycle for p in perm(data): # 순열. (모든 경우의 수)for c in comb(data, 3): # 3개씩 조합.# productl = [(x, -x) for x in numbers] # [(4, -4), ..
from itertools import permutations 로 완전 탐색하기!모든 경우의 수를 다 돌려보며 계산한다. Question 이 게임에는 하루에 한 번씩 탐험할 수 있는 던전이 여러개 있는데, 한 유저가 오늘 이 던전들을 최대한 많이 탐험하려 합니다. 유저의 현재 피로도 k와 각 던전별 "최소 필요 피로도", "소모 피로도"가 담긴 2차원 배열 dungeons 가 매개변수로 주어질 때, 유저가 탐험할수 있는 최대 던전 수를 return 하도록 solution 함수를 완성해주세요. Code : 순열 사용하여 완전 탐색 (모든 경우의 수 돌림) from itertools import permutationsdef solution(k, dungeons): max_cnt = 0 for p..