Conversation
Co-authored-by: 이예진 <86579541+yeahdy@users.noreply.github.com>
BOJ/1000-10000번/JW_4386.java
Outdated
There was a problem hiding this comment.
그러게여..🐹 필요없는 연산입니다!
수정했습니다 ㅎ 감사합니다
BOJ/1000-10000번/JW_1477.java
Outdated
There was a problem hiding this comment.
오호.. 다들 휴게소 개수 짱 깔끔하게 구하셨군요..!!👍
BOJ/1000-10000번/JW_7570.java
Outdated
There was a problem hiding this comment.
저는 왜 빠른 입력 함수만 쓰면 에러가 날까요?,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 요상합니다,,,,,,,,,,,,,,,,,,,,,,,,,ㅋㅎㅋㅎ,, ㅠㅠ !
There was a problem hiding this comment.
나중에 같이 입력함수 이야기해봐요!
| int[][] board = new int[n + 1][m + 1]; | ||
| // 웅덩이가 있는 위치 표시 | ||
| for (int[] puddle : puddles) | ||
| board[puddle[1]][puddle[0]] = -1; |
There was a problem hiding this comment.
저는 웅덩이가 있는 곳을 2차원 boolean 배열을 만들어서 저장해줬는데, 그냥 int형 배열에 모두 다 저장해줘도 됐군요,,,,👍
There was a problem hiding this comment.
최대한 하나의 배열에서 끝내려고 -1로 표기했더니 계산도 간단해지고 괜찮더라구요!
| // 현재 위치가 웅덩이가 아니라면 | ||
| if (board[i][j] != -1) { | ||
| int up = Math.max(0, board[i - 1][j]); // 위쪽에서 오는 경우 | ||
| int lf = Math.max(0, board[i][j - 1]); // 왼쪽에서 오는 경우 |
There was a problem hiding this comment.
이렇게 최댓값으로 바로 받아와도 되는군요..!! 👍 👍
There was a problem hiding this comment.
최댓값으로 0과 함께 받아오면 체크해둔 -1을 무시할 수 있어요!
| l++; | ||
| } | ||
| r--; | ||
| answer++; |
There was a problem hiding this comment.
따로 else문 필요 없이 한번에 증가도 가능하군요...!!
저는 2명 타는 경우랑 1명 타는 경우 이렇게 나눠서 생각 하다보니 else문으로 나눠줬었는데, 불필요한 구현 없이 깔끔한 코드 배워갑니다!👍
No description provided.