Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff7c99d

Browse files
authored
Update 11.java
1 parent2d1423f commitff7c99d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

‎5/11.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
classNode {
44

5-
privateintindex;
6-
privateintdistance;
5+
privateintx;
6+
privateinty;
77

8-
publicNode(intindex,intdistance) {
9-
this.index =index;
10-
this.distance =distance;
8+
publicNode(intx,inty) {
9+
this.x =x;
10+
this.y =y;
1111
}
1212

13-
publicintgetIndex() {
14-
returnthis.index;
13+
publicintgetX() {
14+
returnthis.x;
1515
}
1616

17-
publicintgetDistance() {
18-
returnthis.distance;
17+
publicintgetY() {
18+
returnthis.y;
1919
}
2020
}
2121

@@ -35,8 +35,8 @@ public static int bfs(int x, int y) {
3535
// 큐가 빌 때까지 반복하기
3636
while(!q.isEmpty()) {
3737
Nodenode =q.poll();
38-
x =node.getIndex();
39-
y =node.getDistance();
38+
x =node.getX();
39+
y =node.getY();
4040
// 현재 위치에서 4가지 방향으로의 위치 확인
4141
for (inti =0;i <4;i++) {
4242
intnx =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)

[8]ページ先頭

©2009-2025 Movatter.jp