일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- BFS
- 힙
- level3
- programmers
- 파이썬
- 가상메모리 관리
- MYSQL
- 프로그래머스
- python
- level0
- 수학
- 브루트포스
- 백준
- 가상메모리
- level1
- 그리디
- 코딩테스트
- 재귀
- 구현
- 다이나믹 프로그래밍
- 운영체제
- 스택
- BOJ
- N과M
- 다익스트라
- level2
- dict
- dfs
- DP
- 딕셔너리
- Today
- Total
목록코딩테스트 (45)
동캄의 코딩도장
https://www.acmicpc.net/problem/1107 1107번: 리모컨 첫째 줄에 수빈이가 이동하려고 하는 채널 N (0 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 고장난 버튼의 개수 M (0 ≤ M ≤ 10)이 주어진다. 고장난 버튼이 있는 경우에는 셋째 줄에는 고장난 버튼 www.acmicpc.net # 백준 1107 리모컨 from itertools import product num = input() want = list(map(int, num)) l = len(want) num = int(num) n = int(input()) if n == 0: use = [i for i in range(10)] else: delbtn = list(map(int, input().split(..
https://programmers.co.kr/learn/courses/30/lessons/49189 코딩테스트 연습 - 가장 먼 노드 6 [[3, 6], [4, 3], [3, 2], [1, 3], [1, 2], [2, 4], [5, 2]] 3 programmers.co.kr # 프로그래머스 가장 먼노드 def solution(n, edge): answer = 0 visited = [0]*(n+1) cnt = [10000]*(n+1) link = [[] for _ in range(n+1)] for e in edge: a, b = e link[a].append(b) link[b].append(a) cnt[1] = 0 def serach_dfs(node, count_): cnt[int(node)] = min..
https://programmers.co.kr/learn/courses/30/lessons/43164 코딩테스트 연습 - 여행경로 [["ICN", "SFO"], ["ICN", "ATL"], ["SFO", "ATL"], ["ATL", "ICN"], ["ATL","SFO"]] ["ICN", "ATL", "ICN", "SFO", "ATL", "SFO"] programmers.co.kr # 프로그래머스 여행경로 def solution(tickets): global answer answer = [] fromto = {} manage_ticket = {} temp = [] for ticket in tickets: dep, arr = ticket manage_ticket[dep+arr] = 0 fromto[dep] ..
https://programmers.co.kr/learn/courses/30/lessons/42861 코딩테스트 연습 - 섬 연결하기 4 [[0,1,1],[0,2,2],[1,2,5],[1,3,1],[2,3,8]] 4 programmers.co.kr # 프로그래머스 섬 연결하기 def solution(n, costs): answer = 0 costs.sort(key=lambda x: x[2]) island = {} cnt = 0 for i in range(n): island[i] = 0 a, b, c = costs.pop(0) island[a] += 1 island[b] += 1 answer += c cnt += 1 while cnt != n-1: for i in range(len(costs)): a, b..
https://programmers.co.kr/learn/courses/30/lessons/42628 코딩테스트 연습 - 이중우선순위큐 programmers.co.kr # 프로그래머스 이중우선순위큐 import heapq def solution(operations): answer = [] heap = [] for operation in operations: oper, digit = map(str, operation.split()) if oper == 'I': heapq.heappush(heap, int(digit)) elif heap and oper == 'D' and digit == '1': heap = heapq.nlargest(len(heap), heap)[1:] heapq.heapify(heap)..
https://www.acmicpc.net/problem/2805 2805번: 나무 자르기 첫째 줄에 나무의 수 N과 상근이가 집으로 가져가려고 하는 나무의 길이 M이 주어진다. (1 ≤ N ≤ 1,000,000, 1 ≤ M ≤ 2,000,000,000) 둘째 줄에는 나무의 높이가 주어진다. 나무의 높이의 합은 항상 M보 www.acmicpc.net #백준 2805 import sys import math input = sys.stdin.readline answer = 0 N, M = map(int, input().split()) lst = list(map(int, input().split())) lst.sort() S = sum(lst) for i in range(len(lst)): answer = m..