[20251126] BOJ / G5 / 행복 유치원 / 이준희 #1518
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/13164
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
키 순서대로 주어진 아이들이 있을 때 K개의 조로 나누어 티셔츠를 맞추려고 합니다.
이 때 조를 만들 때 아이들의 순서는 건들지 않습니다.
조의 티셔츠 제작 비용은 조에서 키가 가장 큰 녀석과 가장 작은 녀석의 키 차이일 때
티셔츠 제작 비용이 최소가 되는 경우의 비용을 구하는 문제입니다.
🔍 풀이 방법
아이들의 키 차이를 계산하여 이를 배열로 만들었습니다.
이후 이 배열을 정렬해서 키차이가 큰 경우를 빼고 N-K개 만큼 더했습니다.
⏳ 회고
그리디? 문제였씁니다.