Conversation
imcheck
requested changes
Feb 6, 2025
| x = half - i - 1; | ||
| y = half - i; | ||
| for (int j = 0; j < 4; j++) { // 상, 우, 하, 좌 (4번 반복) | ||
| for (int k = 0; k < step; k++) { |
Owner
There was a problem hiding this comment.
for 안에 if, else구문은 중요도나 비중이 높은 순서대로 적어주는게 코드가 좀 더 직관적이고 읽기 좋아
이거 같은 경우는 if 가 마지막 한번만 실행되고 대부분은 else가 실행되기 때문에 사실 순서를 바꾸는게 좋고 더 나아가 아래처럼 아예 if, else를 안쓰는게 가장 좋은 거 같아
for (int k = 0; k < step-1; k++) {
arr[x][y] = ++count;
x += dx[v];
y += dy[v];
}
// 방향 전환
x += vx[v];
y += vy[v];이게 좀 더 직관적이고 깔끔한거 같아.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1913번 문제 기존 코드 수정,
1913번 문제 (달팽이) 다른 풀이 추가했습니다.