![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FmT4s2%2FbtrGtPEQmGa%2FPHKiNDHcSIvsIG0eMcb1Fk%2Fimg.png)
[C++] BOJ 2178๋ฒ: ๋ฏธ๋ก ํ์
ยท
์๊ณ ๋ฆฌ์ฆ/BaekJoon
๋ฌธ์ 1์ ์ด๋ํ ์ ์๋ ์นธ, 0์ ์ด๋ํ ์ ์๋ ์นธ์ ๋ํ๋ธ๋ค. (1,1)์์ ์ถ๋ฐํ์ฌ (N,M)์ ์์น๋ก ์ด๋ํ ๋ ์ง๋์ผ ํ๋ ์ต์ ์นธ์ ์๋ฅผ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ ์์ฑํ์์ค. ์
๋ ฅ 1 4 6 101111 101010 101011 111011 ์ถ๋ ฅ 1 15 ์ฝ๋ #include #include #include #define MAX 101 using namespace std; int MAP[MAX][MAX]; int visited[MAX][MAX]; int dist[MAX][MAX]; int arrow[4][2] = { {1,0},{-1,0},{0,1},{0,-1} }; int N, M; pair startP, endP; queue Q; void BFS() { Q.push(make_pai..