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/2877
🧭 풀이 시간
20 분
👀 체감 난이도
✏️ 문제 설명
창영이는 4와 7로 이루어진 수를 좋아한다. 창영이가 좋아하는 수 중에 K번째 작은 수를 구해 출력하는 프로그램을 작성하시오.
🔍 풀이 방법
자릿수의 마지막 번호는 2, (2 + 4), (2 + 4 + 8) 식으로 늘어난다.
N이 포함된 자릿수를 구하고(자릿수를 k라 하면)
이전 자릿수의 마지막 번호(2 + 4) +$2^{k-1}$ 이 N보다 크다면? N의 맨 앞 자리 값이 7이고,
N보다 작다면? N의 맨 앞 자리 값이 4이다.
이를 활용해서 계산한다.
⏳ 회고
엠로 코딩 테스트에서 나온 문제이다.