일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- OOP
- 셀레니움
- literal
- Reference Type
- BFS
- X.org
- descriptive statistics
- python
- Mac
- Physical Scheme
- 리눅스
- 리눅스 마스터 1급
- Binary Search
- 자바
- dbms
- Inheritance
- Entity Set
- Operator
- External Scheme
- Class
- Unity
- Entity
- X윈도우
- systemd
- Java
- 백준
- selenium
- Polymolphism
- preprocessing
- spring
- Today
- Total
목록dfs (2)
Byeol Lo
미로 문제가 나왔을때 다음과 같이 변수들을 선언하고 알고리즘을 짠다. 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가 난..
직사각형이 다음과 같이 주어진다고 하자. (x1, y1, x2, y2) 좌표계는 1부터 50까지 있다고 치면, 많은 직사각형들에 대해 외곽을 다음 로직을 통해 list로 구현 할 수 있다. def draw(rectangles) : map = [[9]*50 for _ in range(50)] for rect in rectangles : for x in range(rect[0], rect[2]+1) : for y in range(rect[1], rect[3]+1) : if rect[0] < x < rect[2] and rect[1] < y < rect[3] : map[y][x] = 0 elif map[y][x] : map[y][x] = 1 for i in map : print(*i) if __name__ =..