[20250919] BOJ / G5 / 1학년 / 이준희 #924
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/5557
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
상근이는 숫자열을 보면 마지막 수 앞에 = 을 붙히고 그 앞 숫자들 사이에는 + 또는 - 를 붙혀서 올바른 등식을 만드는 것을 좋아합니다.
숫자열이 주어졌을 때 올바른 등식을 만들 수 있는 경우의 수를 구하는 문제입니다.
🔍 풀이 방법
DP를 활용하여 풀었습니다. dp[i][j] 는 i번째 수 까지 연산 했을 때 j 가 되는 경우의 수로 두어서 i-1 번째의 경우의 수를 더해주면서 풀었습니다.
⏳ 회고
다 풀고 제출하려고 테스트케이스를 돌려보니 갑자기 음수가 나오길래 봤더니 overflow 문제였습니다. long, int 판단을 잘 해야겠습니다.