[20260102] BOJ / G5 / 간판 만들기 / 권혁준 #1762
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/34894
🧭 풀이 시간
10분
👀 체감 난이도
✏️ 문제 설명
길이 N인 문자열 s가 주어진다.
i번째 글자를 전광판에 띄우는 비용은 S[i]이다.
전광판에 "UOSPC"를 띄우는 최소 비용을 구해보자.
🔍 풀이 방법
dp[i][j] = i번째 글자까지 사용해서 UOSPC중 j번째 인덱스까지 완성하는 경우의 수로 정의한다.
s[i] == "UOSPC"[j]이면 dp[i][j] = min(dp[i][j], dp[i-1][j-1] + S[i]) 이다.
⏳ 회고
HNY