Skip to content

Commit ff7c99d

Browse files
authored
Update 11.java
1 parent 2d1423f commit ff7c99d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

5/11.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
class Node {
44

5-
private int index;
6-
private int distance;
5+
private int x;
6+
private int y;
77

8-
public Node(int index, int distance) {
9-
this.index = index;
10-
this.distance = distance;
8+
public Node(int x, int y) {
9+
this.x = x;
10+
this.y = y;
1111
}
1212

13-
public int getIndex() {
14-
return this.index;
13+
public int getX() {
14+
return this.x;
1515
}
1616

17-
public int getDistance() {
18-
return this.distance;
17+
public int getY() {
18+
return this.y;
1919
}
2020
}
2121

@@ -35,8 +35,8 @@ public static int bfs(int x, int y) {
3535
// 큐가 빌 때까지 반복하기
3636
while(!q.isEmpty()) {
3737
Node node = q.poll();
38-
x = node.getIndex();
39-
y = node.getDistance();
38+
x = node.getX();
39+
y = node.getY();
4040
// 현재 위치에서 4가지 방향으로의 위치 확인
4141
for (int i = 0; i < 4; i++) {
4242
int nx = x + dx[i];
@@ -76,4 +76,4 @@ public static void main(String[] args) {
7676
System.out.println(bfs(0, 0));
7777
}
7878

79-
}
79+
}

0 commit comments

Comments
 (0)