-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3-6.cpp
More file actions
35 lines (33 loc) · 725 Bytes
/
3-6.cpp
File metadata and controls
35 lines (33 loc) · 725 Bytes
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
32
33
34
35
// 등굣길
// 2019.10.12
// 다이나믹 프로그래밍
#include<vector>
#include<iostream>
using namespace std;
int d[101][101];
int solution(int m, int n, vector<vector<int>> puddles) {
int answer = 0;
for(int i=0;i<puddles.size();i++)
{
d[puddles[i][1]][puddles[i][0]]=-1; //웅덩이
}
d[1][1]=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if (d[i][j] == -1)
{
d[i][j] = 0;
continue;
}
if(i==1 && j==1)
{
continue;
}
d[i][j]=(d[i-1][j]+d[i][j-1])%1000000007;
}
}
answer=d[n][m]%1000000007;
return answer;
}