[20260306] BOJ / G3 / 선물 전달 / 이준희#1996
Merged
ShinHeeEul merged 2 commits intomainfrom Mar 6, 2026
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/1947
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
참가자가 선물을 가져와 나누려고 할 때
자기 자신의 선물을 자신이 받지 않고 전부 나누는 경우의 수를 구하는 문제입니다.
🔍 풀이 방법
점화식을 구했습니다.
dp[i] = dp[i-1] * (dp[i-1] + dp[i+1]) 의 점화식을 도출했습니다.
i 번째를 i번째가 아닌 나머지 중에 1개에 둔다 = dp[i-1]
이후 2가지의 분기가 있습니다.
이제 j 번을 i번에 둔다 = i랑 j가 맞교환되고 나머지것들로 다시 분배한다 = dp[i-2]
or
j번을 i번이 아닌 다른곳에 둔다 = j를 새로운 i로 처리하여 다시 분배한다 = dp[i-1]
위 점화식을 이용해서 풀었습니다.
⏳ 회고
점화식을 떠올리기가 매우 어려웠던 것 같습니다