We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1588178 commit 8c58e21Copy full SHA for 8c58e21
1 file changed
live10/test106/문제3/박희경.py
@@ -0,0 +1,30 @@
1
+def solution(m, n, puddles):
2
+ graph = [[-1] * m for _ in range(n)]
3
+
4
+ graph[0][0] = 1
5
6
+ # 웅덩이 체크
7
+ for x, y in puddles:
8
+ graph[y - 1][x - 1] = 0
9
10
+ # 첫 열 초기화
11
+ for i in range(1, n):
12
+ if graph[i][0] == 0:
13
+ graph[i][0] = 0
14
+ else:
15
+ graph[i][0] = graph[i - 1][0]
16
17
+ # 첫 행 초기화
18
+ for j in range(1, m):
19
+ if graph[0][j] == 0:
20
+ graph[0][j] = 0
21
22
+ graph[0][j] = graph[0][j - 1]
23
24
+ # 웅덩이 제외 경로 계산
25
26
27
+ if graph[i][j] != 0:
28
+ graph[i][j] = graph[i-1][j] + graph[i][j-1]
29
30
+ return graph[n-1][m-1] % 1000000007
0 commit comments