[Python] 프로그래머스 - 등굣길
문제 링크
문제 풀이
def isPuddle(puddles,i,j):
for puddle in puddles:
if puddle[1] == i and puddle[0] ==j:
return True
return False
def solution(m, n, puddles):
dp = [[0 for i in range(m+1)]for j in range(n+1)]
dp[1][1]=1
for i in range(1,n+1):
for j in range(1,m+1):
if i!=1 or j!=1:
if not isPuddle(puddles,i,j):
dp[i][j] = (dp[i-1][j] + dp[i][j-1])%1000000007
else:
dp[i][j]=0
return dp[n][m]
댓글남기기