Skip to content

Commit 7e8df02

Browse files
committed
1 parent c4076ff commit 7e8df02

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Hongjoo/lv3/등교길.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
def solution(m, n, puddles):
2+
#DP
3+
answer = 0
4+
#1.i=0,1 or j=0,1 -> map[i.j] =1
5+
map = [[1]*(m+1) for _ in range(n+1)]#n+1xm+1
6+
#print(map)
7+
# puddles -> map[i,j] =0 으로 세팅
8+
# for p in puddles :
9+
# map[p[0]][p[1]] = 0
10+
11+
for i in range(n+1):
12+
for j in range(m+1):
13+
if [i,j] in puddles:
14+
print("##p=0:",i,j,"skip")
15+
map[i][j] = 0
16+
continue
17+
if i in [0,1] or j in [0,1] :
18+
print("##p=1:",i,j,"skip")
19+
continue
20+
map[i][j] = map[i][j-1] + map[i-1][j]
21+
#print(i,j,":",map[i][j] ,"=", map[i][j-1] ,"+", map[i-1][j])
22+
#print(map)
23+
answer = map[n][m]
24+
25+
#print(map[n][m-1]+map[n-1][m] )
26+
return answer%1000000007

0 commit comments

Comments
 (0)