diff --git "a/solution/BOJ_14442_\353\262\275-\353\266\200\354\210\230\352\263\240-\354\235\264\353\217\231\355\225\230\352\270\2602/ykm.java" "b/solution/BOJ_14442_\353\262\275-\353\266\200\354\210\230\352\263\240-\354\235\264\353\217\231\355\225\230\352\270\2602/ykm.java" index f4a57e8..3156dd9 100644 --- "a/solution/BOJ_14442_\353\262\275-\353\266\200\354\210\230\352\263\240-\354\235\264\353\217\231\355\225\230\352\270\2602/ykm.java" +++ "b/solution/BOJ_14442_\353\262\275-\353\266\200\354\210\230\352\263\240-\354\235\264\353\217\231\355\225\230\352\270\2602/ykm.java" @@ -9,8 +9,8 @@ public class Main{ public static class node{ int x, y; - int move; - int wall; + int move; // 이동횟수 + int wall; // 부슨 벽의 수 public node(int x, int y, int move, int wall){ this.x = x; @@ -18,11 +18,6 @@ public node(int x, int y, int move, int wall){ this.move = move; this.wall = wall; } - - @Override - public String toString() { - return "node [move=" + move + ", wall=" + wall + ", x=" + x + ", y=" + y + "]"; - } } static int M; @@ -43,7 +38,7 @@ public static void main(String[] args)throws IOException{ N = Integer.parseInt(st.nextToken()); K = Integer.parseInt(st.nextToken()); map = new char[M][N]; - isVisited = new boolean[M][N][K+1]; // 위치, 부슨벽의 수 + isVisited = new boolean[M][N][K+1]; // 위치 x,y , 부슨벽의 수 for(int i = 0 ; i q = new ArrayDeque(); - q.offer(new node(0,0,1,K)); - + q.offer(new node(0,0,1,0)); + while(!q.isEmpty()){ node current = q.poll(); @@ -72,16 +67,15 @@ public static void main(String[] args)throws IOException{ continue; } - if(isVisited[nextX][nextY][current.wall]){ - continue; - } - if(map[nextX][nextY]=='1'){ // 벽 if(current.wall