Merged
Conversation
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.
🧷 문제 링크
https://www.acmicpc.net/problem/1484
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
다이어트를 하려는 성원이가 G키로가 쪘다고 울부짖고 있습니다.
이 때 G키로는 성원이가 기억하던 예전 몸무게의 제곱과 현재 몸무게의 제곱의 차입니다.
성원이의 몸무게로 가능한 것을 오름차순으로 출력하는 문제입니다.
🔍 풀이 방법
투포인터를 이용해서 풀었습니다.
low는1, high는2로 시작하여 제곱의 차를 구해서 G보다 낮은 경우에는 범위를 늘려가며 값을 구했습니다.
low와 high의 차가 1일 때 제곱의 차가 G보다 크다면, 앞으로는 무조건 그 차들이 계속 커지기 때문에 종료했습니다.
⏳ 회고
처음에는 전체 탐색을 했는데, 투포인터를 활용해야해서 생각보다 어려웠던 것 같습니다.