Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions kangrae-jo/DP/35-kangrae-jo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <vector>

using namespace std;

const int PATH = 0;
const int WALL = 1;
const int FIX = 2;
const int MOD = 20170805;

int solution(int m, int n, vector<vector<int>> board) {
vector<vector<int>> down (m, vector<int> (n, 0));
vector<vector<int>> right(m, vector<int> (n, 0));

for (int y = 0; y < m; y++) {
if (board[y][0] == WALL) break;
down[y][0] = 1;
}
for (int x = 0; x < m; x++) {
if (board[0][x] == WALL) break;
right[0][x] = 1;
}

for (int y = 1; y < m; y++) {
for (int x = 1; x < n; x++) {
// μ§„μž… λΆˆκ°€
if (board[y][x] == WALL) continue;

// μœ„μ—μ„œ μ•„λž˜λ‘œ
if (board[y - 1][x] == FIX) down[y][x] = down[y - 1][x];
else down[y][x] = (down[y - 1][x] + right[y - 1][x]) % MOD;

// μ™Όμͺ½μ—μ„œ 였λ₯Έμͺ½μœΌλ‘œ
if (board[y][x - 1] == FIX) right[y][x] = right[y][x - 1];
else right[y][x] = (down[y][x - 1] + right[y][x - 1]) % MOD;
}
}

return (down[m - 1][n - 1] + right[m - 1][n - 1]) % MOD;
}
41 changes: 21 additions & 20 deletions kangrae-jo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,24 @@
| 12μ°¨μ‹œ | 2024.12.24 | HEAP | [크리슀마슀 μ„ λ¬Ό](https://www.acmicpc.net/problem/14235)|[#44](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/44)|
| 13μ°¨μ‹œ | 2024.12.28 | Graph | [쀄 μ„Έμš°κΈ°](https://www.acmicpc.net/problem/2252)|[#46](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/46)|
| 14μ°¨μ‹œ | 2024.12.31 | Two Pointer | [두 μš©μ•‘](https://www.acmicpc.net/problem/2470)|[#48](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/48)|
| 15μ°¨μ‹œ | 2024.01.11 | κ΅¬ν˜„ | [λ™μ˜μƒ μž¬μƒκΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/340213?language=cpp)|[#57](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/57)|
| 16μ°¨μ‹œ | 2024.01.14 | BinarySearch | [퍼즐 κ²Œμž„ μ±Œλ¦°μ§€](https://school.programmers.co.kr/learn/courses/30/lessons/340212)|[#59](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/59)|
| 17μ°¨μ‹œ | 2024.01.18 | Simulation | [좩돌 μœ„ν—˜ μ°ΎκΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/340211)|[#61](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/61)|
| 18μ°¨μ‹œ | 2024.02.04 | Queue | [두 큐 ν•© κ°™κ²Œ λ§Œλ“€κΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/118667)|[#69](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/69)|
| 19μ°¨μ‹œ | 2024.02.11 | Backtracking | [λΉ„λ°€ μ½”λ“œ 해독](https://school.programmers.co.kr/learn/courses/30/lessons/388352)|[#72](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/72)|
| 20μ°¨μ‹œ | 2024.02.24 | BinarySearch | [금과 은 μš΄λ°˜ν•˜κΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/86053)|[#75](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/75)|
| 21μ°¨μ‹œ | 2024.03.01 | HEAP | [μ ˆλŒ“κ°’ νž™](https://www.acmicpc.net/problem/11286)|[#80](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/80)|
| 22μ°¨μ‹œ | 2024.03.04 | Prefix Sum | [체슀판 λ‹€μ‹œ μΉ ν•˜κΈ°2](https://www.acmicpc.net/problem/25682)|[#81](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/81)|
| 23μ°¨μ‹œ | 2024.03.25 | HEAP | [νšŒμ „ν•˜λŠ” 큐](https://www.acmicpc.net/problem/1021)|[#88](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/88)|
| 24μ°¨μ‹œ | 2024.04.07 | DP | [동전 1](https://www.acmicpc.net/problem/2293)|[#95](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/95)|
| 25μ°¨μ‹œ | 2024.04.29 | HEAP | [쀑앙값 κ΅¬ν•˜κΈ°](https://www.acmicpc.net/problem/2696)|[#97](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/97)|
| 26μ°¨μ‹œ | 2024.05.19 | DFS | [κΈΈ μ°ΎκΈ° κ²Œμž„](https://school.programmers.co.kr/learn/courses/30/lessons/42892)|[#103](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/103)|
| 27μ°¨μ‹œ | 2024.06.01 | DFS | [개미꡴](https://www.acmicpc.net/problem/14725)|[#107](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/107)|
| 28μ°¨μ‹œ | 2024.06.10 | BFS | [경주둜 건섀](https://school.programmers.co.kr/learn/courses/30/lessons/67259)|[#110](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/110)|
| 29μ°¨μ‹œ | 2024.06.19 | TRIE | [[3μ°¨] μžλ™μ™„μ„±](https://school.programmers.co.kr/learn/courses/30/lessons/17685)|[#114](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/114)|
| 30μ°¨μ‹œ | 2024.07.18 | BFS | [치즈](https://www.acmicpc.net/problem/2638)|[#117](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/117)|
| 31μ°¨μ‹œ | 2024.07.31 | Prefix Sum | [두 λ°°μ—΄μ˜ ν•©](https://www.acmicpc.net/problem/2143)|[#122](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/122)|
| 32μ°¨μ‹œ | 2024.08.10 | BFS | [퍼즐 쑰각 μ±„μš°κΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/84021)|[#130](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/130)|
| 33μ°¨μ‹œ | 2024.08.18 | UnionFind | [μΉ΄λ“œ κ²Œμž„](https://www.acmicpc.net/problem/16566)|[#133](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/133)|
| 34μ°¨μ‹œ | 2024.08.28 | Graph | [μ›œν™€](https://www.acmicpc.net/problem/1865)|[#122](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/136)|
| 15μ°¨μ‹œ | 2025.01.11 | κ΅¬ν˜„ | [λ™μ˜μƒ μž¬μƒκΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/340213?language=cpp)|[#57](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/57)|
| 16μ°¨μ‹œ | 2025.01.14 | BinarySearch | [퍼즐 κ²Œμž„ μ±Œλ¦°μ§€](https://school.programmers.co.kr/learn/courses/30/lessons/340212)|[#59](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/59)|
| 17μ°¨μ‹œ | 2025.01.18 | Simulation | [좩돌 μœ„ν—˜ μ°ΎκΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/340211)|[#61](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/61)|
| 18μ°¨μ‹œ | 2025.02.04 | Queue | [두 큐 ν•© κ°™κ²Œ λ§Œλ“€κΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/118667)|[#69](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/69)|
| 19μ°¨μ‹œ | 2025.02.11 | Backtracking | [λΉ„λ°€ μ½”λ“œ 해독](https://school.programmers.co.kr/learn/courses/30/lessons/388352)|[#72](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/72)|
| 20μ°¨μ‹œ | 2025.02.24 | BinarySearch | [금과 은 μš΄λ°˜ν•˜κΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/86053)|[#75](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/75)|
| 21μ°¨μ‹œ | 2025.03.01 | HEAP | [μ ˆλŒ“κ°’ νž™](https://www.acmicpc.net/problem/11286)|[#80](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/80)|
| 22μ°¨μ‹œ | 2025.03.04 | Prefix Sum | [체슀판 λ‹€μ‹œ μΉ ν•˜κΈ°2](https://www.acmicpc.net/problem/25682)|[#81](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/81)|
| 23μ°¨μ‹œ | 2025.03.25 | HEAP | [νšŒμ „ν•˜λŠ” 큐](https://www.acmicpc.net/problem/1021)|[#88](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/88)|
| 24μ°¨μ‹œ | 2025.04.07 | DP | [동전 1](https://www.acmicpc.net/problem/2293)|[#95](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/95)|
| 25μ°¨μ‹œ | 2025.04.29 | HEAP | [쀑앙값 κ΅¬ν•˜κΈ°](https://www.acmicpc.net/problem/2696)|[#97](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/97)|
| 26μ°¨μ‹œ | 2025.05.19 | DFS | [κΈΈ μ°ΎκΈ° κ²Œμž„](https://school.programmers.co.kr/learn/courses/30/lessons/42892)|[#103](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/103)|
| 27μ°¨μ‹œ | 2025.06.01 | DFS | [개미꡴](https://www.acmicpc.net/problem/14725)|[#107](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/107)|
| 28μ°¨μ‹œ | 2025.06.10 | BFS | [경주둜 건섀](https://school.programmers.co.kr/learn/courses/30/lessons/67259)|[#110](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/110)|
| 29μ°¨μ‹œ | 2025.06.19 | TRIE | [[3μ°¨] μžλ™μ™„μ„±](https://school.programmers.co.kr/learn/courses/30/lessons/17685)|[#114](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/114)|
| 30μ°¨μ‹œ | 2025.07.18 | BFS | [치즈](https://www.acmicpc.net/problem/2638)|[#117](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/117)|
| 31μ°¨μ‹œ | 2025.07.31 | Prefix Sum | [두 λ°°μ—΄μ˜ ν•©](https://www.acmicpc.net/problem/2143)|[#122](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/122)|
| 32μ°¨μ‹œ | 2025.08.10 | BFS | [퍼즐 쑰각 μ±„μš°κΈ°](https://school.programmers.co.kr/learn/courses/30/lessons/84021)|[#130](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/130)|
| 33μ°¨μ‹œ | 2025.08.18 | UnionFind | [μΉ΄λ“œ κ²Œμž„](https://www.acmicpc.net/problem/16566)|[#133](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/133)|
| 34μ°¨μ‹œ | 2025.08.28 | Graph | [μ›œν™€](https://www.acmicpc.net/problem/1865)|[#122](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/136)|
| 35μ°¨μ‹œ | 2025.11.18 | DP | [λ³΄ν–‰μž 천ꡭ](https://school.programmers.co.kr/learn/courses/30/lessons/1832)|[#138](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/138)|