[20250908] BOJ / G3 / 행렬 곱셈 순서 / 한종욱 #845
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/11049
🧭 풀이 시간
90분
👀 체감 난이도
✏️ 문제 설명
행렬의 곱인데 연산의 수가 제일 적은 값은?
🔍 풀이 방법
dp[i][j]=i번째부터 j번째 행렬까지 곱하는 최소 연산 횟수dp[i][j] = min(dp[i][k] + dp[k+1][j] + 연결비용)
(i ≤ k < j)
연결비용 = matrix[i].행 × matrix[k].열 × matrix[j].열
길이가 2인 것부터 N인 것까지 계산 -> 각 구간을 모든 k로 쪼개서 최소값 찾기
⏳ 회고
3중 for문을 구현하는거 너무 어렵다.