일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Entity
- External Scheme
- Physical Scheme
- dbms
- 리눅스 마스터 1급
- systemd
- Unity
- 백준
- X윈도우
- Binary Search
- spring
- Mac
- 셀레니움
- descriptive statistics
- python
- Inheritance
- selenium
- X.org
- preprocessing
- BFS
- 리눅스
- Entity Set
- OOP
- literal
- Operator
- 자바
- Polymolphism
- Java
- Class
- Reference Type
- Today
- Total
목록미로찾기 (2)
Byeol Lo
from collections import deque graph = [ [1,1,1,0,0], [1,0,1,0,1], [1,1,1,1,1], [1,1,0,0,1], [1,1,1,1,1] ] dx = [1,-1,0,0] dy = [0,0,1,-1] visited = [[False]*5 for _ in range(5)] path = deque() def solution(graph, visited, x, y) : visited[y][x] = True path = deque([[x, y]]) while path : x, y = path.popleft() for i in range(4) : pos1, pos2 = x+dx[i], y+dy[i] if 0
미로 문제가 나왔을때 다음과 같이 변수들을 선언하고 알고리즘을 짠다. graph = [ [1,1,1,0,1], [1,0,1,1,1], [1,1,1,0,1], [1,0,1,0,1], [1,1,1,1,1] ] visited = [[False]*len(graph[0]) for _ in range(len(graph))] dx = [1,-1,0,0] dy = [0,0,1,-1] def solution(graph, visited, x, y, walk) : if not visited[y][x] or visited[y][x] > walk : visited[y][x] = walk else : return for i in range(4) : pos1 = x+dx[i] pos2 = y+dy[i] # indexerror가 난..