일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 프로그래머스
- leetcode
- 코딩테스트준비
- 항해99
- 활성화 함수
- 큐
- 파이썬
- 구현
- Python
- 코딩테스트 준비
- 개발자 취업
- til
- 혁펜하임
- easy 딥러닝
- 99클럽
- 백준
- python 2309
- dfs
- 백준 2309
- 해시
- BFS
- BOJ
- 딥러닝
- 99항해
- boj 2309
- 기능개발
- 스택
- 개발자취업
- 알고리즘
- softeer
- Today
- Total
목록항해99 (16)
동까의 코딩
https://www.acmicpc.net/problem/2151 from collections import dequeimport sysinput = sys.stdin.readlinedx = [0, 1, 0, -1]dy = [1, 0, -1, 0]def bfs(x, y, dir): q.append([x, y, dir]) c[x][y][dir] = 1 ans = [] while q: x, y, dir = q.popleft() nx = x + dx[dir] ny = y + dy[dir] if 0 c[x][y][dir]: if a[nx][ny] != '*': c[nx][ny][..
https://www.acmicpc.net/problem/2169 로봇은 아래,오른쪽,왼쪽으로만 움직이며 한번 지나친 곳은 지나가지 못함해당 row에서 한번 왼쪽으로 움직으면 왼쪽으로만, 오른쪽으로 움직이면 오른쪽으로만 움직임왼쪽으로 움직였을 경우와 오른쪽으로 움직였을 경우 두가지로 나누어 계산하면 모든 경우의 수 계산이 가능해짐r,c 지점에서의 최대 값은 윗층(r-1,c)에서 내려온 값, 왼쪽(r,c-1)에서 온 값, 오른쪽(r,c+1)에서 온 값 세가지로 분류 가능왼쪽, 오른쪽으로만 움직일 경우로 분리하고 각각의 경우에 최대값을 찾은 후 병합 import sysinput = sys.stdin.readlinedef solution(R,C,arr): for c in range(1,C): ..
https://www.acmicpc.net/problem/1738 벨만포드 알고리즘에 대해 더 깊게 이해해야될 것 같다.....아직도 모르는 게 많은 것 같다. import sysINF= sys.maxsizedef bellman(start): global n distance = [-INF]*(n+1) distance[start]=0 route= [0]*(n+1) result=[] for i in range(n): for cur_node in range(1, n+1): if distance[cur_node]==-INF: continue for next_node, next_cost in graph[cur_node]: if distance[next..
https://www.acmicpc.net/problem/2179 정렬 알고리즘 문제를 풀어보았습니다. n = int(input())a = [input() for _ in range(n)]b = sorted(list(enumerate(a)),key = lambda x: x[1])def check(a, b): cnt = 0 for i in range(min(len(a), len(b))): if a[i] == b[i]: cnt += 1 else: break return cntlength = [0] * (n+1)maxlength = 0for i in range(n-1): tmp = check(b[i][1], b[i+1][1]) maxlength..
https://school.programmers.co.kr/learn/courses/30/lessons/92343 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr def solution(info, edges): answer = [] visited = [False] * len(info) def dfs(sheeps, wolves): if sheeps > wolves: answer.append(sheeps) else: return for i, j in edges: ..
https://www.acmicpc.net/problem/1504 최단경로를 푸는 문제이고, 최단경로 코드를 참고하였습니다. 내일 또 다시 풀어볼 예정입니다. import heapqimport sysinput = sys.stdin.readlineINF = int(1e9)v, e = map(int, input().split())graph = [[] for _ in range(v + 1)]for _ in range(e): x, y, cost = map(int, input().split()) graph[x].append((y, cost)) graph[y].append((x, cost))def dijkstra(start): distance = [INF] * (v + 1) q = [] ..
https://www.acmicpc.net/problem/1253 시간복잡도가 중요한 문제이기 때문에 투포인터로 문제를 풀이했다. import sysinput = sys.stdin.readlinen = int(input())arr = list(map(int, input().split()))arr.sort()cnt = 0for i in range(n): end = arr[i] start = 0 tail = len(arr) - 1 while start end: tail -= 1 elif arr[start] + arr[tail]
https://school.programmers.co.kr/learn/courses/30/lessons/60060?language=python3 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr def solution(words, queries): answer = [] for st in queries: cnt = 0 start = 0 end = len(st) if st[0] == '?': for j in range(len(st)): if st[j] != '?': ..