Skip to content

Commit 474ec76

Browse files
committed
Lv3_등굣길
1 parent 3cb0a2e commit 474ec76

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

Programmers/Lv3/Lv3_등굣길.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <string>
2+
#include <vector>
3+
#include <iostream>
4+
using namespace std;
5+
6+
int solution84(int m, int n, vector<vector<int>> puddles) {
7+
int road[101][101] = { 0, };
8+
int check[101][101] = { 0, };
9+
10+
for (int i = 0; i < puddles.size(); i++) // ¹°Àº 0
11+
check[puddles[i][1]][puddles[i][0]] = -1;
12+
13+
road[1][0] = 1;
14+
for (int i = 1; i <= n; i++) {
15+
for (int j = 1; j <= m; j++) {
16+
if (check[i][j] == -1) // ¹°
17+
road[i][j] = 0;
18+
else // ¶¥
19+
road[i][j] = (road[i][j - 1] + road[i - 1][j]) % 1000000007;
20+
}
21+
}
22+
return road[n][m];
23+
}

Programmers/Lv3/Lv3_정수삼각형.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,3 @@ int solution83(vector<vector<int>> triangle) {
2828
return answer;
2929
}
3030

31-
int main() {
32-
vector<vector<int>> triangle = { {7},{3,8},{8, 1, 0},{2, 7, 4, 4},{4, 5, 2, 6, 5} };
33-
cout << solution83(triangle);
34-
return 0;
35-
}

Programmers/Programmers.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
<ClCompile Include="Lv2\Lv2_행렬의곱셈.cpp" />
9696
<ClCompile Include="Lv3\Lv3_2xn타일링.cpp" />
9797
<ClCompile Include="Lv3\Lv3_단속카메라.cpp" />
98+
<ClCompile Include="Lv3\Lv3_등굣길.cpp" />
9899
<ClCompile Include="Lv3\Lv3_디스크컨트롤러.cpp" />
99100
<ClCompile Include="Lv3\Lv3_베스트앨범.cpp" />
100101
<ClCompile Include="Lv3\Lv3_섬연결하기.cpp" />

Programmers/Programmers.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,5 +264,8 @@
264264
<ClCompile Include="Lv3\Lv3_정수삼각형.cpp">
265265
<Filter>소스 파일</Filter>
266266
</ClCompile>
267+
<ClCompile Include="Lv3\Lv3_등굣길.cpp">
268+
<Filter>소스 파일</Filter>
269+
</ClCompile>
267270
</ItemGroup>
268271
</Project>

0 commit comments

Comments
 (0)