-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BOJ 1074 Z #27
Open
Parkjju
wants to merge
22
commits into
hufslion10th:main
Choose a base branch
from
Parkjju:1074
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
BOJ 1074 Z #27
Conversation
This file contains 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
…rs generate, 최신데이터 반영
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.
BOJ 10174 Z
로직 개요
Node.js / 링크 / 백준 / 재귀
Z 순서로 순회할 때에 주요한 로직은 사각형을 4개의 사분면으로 나누는 것입니다.
구하고자 하는 위치 값을 구하기 위해서는 r행 c열을 보면 됩니다.
예를 들어 N=3인 8*8 = 64 사이즈의 사각형이 있다고 가정합니다.
이때 7행 7열의 위치값을 구하기 위해서는
1,2,3사분면의 사각형 사이즈를 모두 더한 뒤
1사분면을 기준으로 3행 3열의 위치값을 더하면 됩니다.
바닥조건은 2*2사이즈일때 조건에 맞게 0,1,2,3을 리턴하면 됩니다.
temp변수를 두어 재귀호출의 결과값을 저장하고
temp변수값을 리턴하는 방식으로 진행해야 재귀호출의 비효율성을 줄일 수 있습니다.
결과
사각형을 4사분면으로 나누어 위치값을 계산하는 로직을 생각해낸 뒤로는
크게 어렵지 않았던 것 같습니다~~ 다들 도전해보세요 재밌네요 이 문제
레퍼런스
위 강의 수강하시고 푸시면 도움이 많이 될 것 같아요 👍