[20250815] BOJ / G5 / Fly me to the Alpha../ 이종환 #671
Merged
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.
🧷 문제 링크
https://www.acmicpc.net/problem/1011
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
x지점에서 y지점을 향해 최소한의 작동 횟수로 이동하려 한다. 하지만 y지점에 도착해서도 공간 이동장치의 안전성을 위하여 y지점에 도착하기 바로 직전의 이동거리는 반드시 1광년으로 하려 한다.
김우현을 위해 x지점부터 정확히 y지점으로 이동하는데 필요한 공간 이동 장치 작동 횟수의 최솟값을 구하는 프로그램을 작성하라.
🔍 풀이 방법
거리(d) = y-x, k = 루트d라 하였을 떄
거리가 k^2 , k^2+k라는 수들 기준으로 어디에 위치해 있느냐에 따라 각각 답이
2k-1, 2k, 2k+1이 된다.
⏳ 회고
원래 도전하던 문제가 안풀려서 망한줄 알았는데, 다행히 구세주같이 등장해준 문제