Muscardinus
등굣길 본문
728x90
programmers.co.kr/learn/courses/30/lessons/42898?language=cpp
#include <string>
#include <vector>
using namespace std;
const int DIVIDER = 1000000007;
int check[101][101] = {0, };
int visited[101][101] = {0, };
// m열 n행
int solution(int m, int n, vector<vector<int>> puddles) {
for (int i = 0; i < puddles.size(); i++) {
check[puddles[i][1]][puddles[i][0]] = -1; //웅덩이
}
visited[1][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (check[i][j] == -1) visited[i][j] = 0;
else visited[i][j] = (visited[i - 1][j] + visited[i][j - 1]) % DIVIDER;
}
}
return visited[n][m];
}
728x90
Comments