[20260125] BOJ / G4 / 호텔 / 강신지 #1833
Merged
+43
−0
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/1106
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
호텔은 최소 C명 이상 고객을 늘려야 한다.
도시마다 (비용, 늘어나는 고객 수)가 주어지고, 광고는 같은 도시에서 여러 번 해도 된다.
최소 비용을 구하면 된다.
🔍 풀이 방법
dp[x] = x명 늘리는 최소 비용으로 두고, 각 도시마다 dp[j] = min(dp[j], dp[j-gain] + cost) 갱신하면 된다.
한번에 늘릴 수 있는 고객의 최댓값이 100이라서, C명을 넘기는 경우도 최대 100만 더 보면 충분하므로 c~c+100 중 최솟값이 답이다.
⏳ 회고