[20251220] BOJ / G4 / Messi Gimossi / 권혁준#1717
Merged
ShinHeeEul merged 1 commit intomainfrom Dec 20, 2025
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/17297
🧭 풀이 시간
10분
👀 체감 난이도
✏️ 문제 설명
messi(1) = Messi
messi(2) = Messi Gimossi
messi(i) = messi(i-1) + ' ' + messi(i-2)
일 때, messi(INF)의 M번째 글자를 구해보자.
🔍 풀이 방법
messi(i)의 길이를 len[i]라고 하면, len[1] = 5, len[2] = 13, len[i] = len[i-1] + len[i-2] + 1이다.
get(n, k) = messi(n)의 k번째 글자를 리턴하도록 재귀함수를 짰다.
기저 조건은 n <= 2이고, k > len[n-1]일 때는 get(n-2, k-len[n-1]-1)에서, 그렇지 않으면 get(n-1, k)에서 가져오면 된다.
⏳ 회고
ez