From 94594349033b9d1a5984809eff3e2eadcfd6efec Mon Sep 17 00:00:00 2001 From: yukyeongmin <75004920+yukyeongmin@users.noreply.github.com> Date: Thu, 30 Dec 2021 23:22:29 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=9C=A0=EA=B2=BD=EB=AF=BC]=20=EB=B2=BD=20?= =?UTF-8?q?=EB=B6=80=EC=88=98=EA=B3=A0=20=EC=9D=B4=EB=8F=99=ED=95=98?= =?UTF-8?q?=EA=B8=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ykm.java" | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) 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