Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Jun 6, 2025

🧷 문제 링크

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AZZ_XjxKgVLHBINj&categoryId=AZZ_XjxKgVLHBINj&categoryType=CODE&problemTitle=24396&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=&pageSize=10&pageIndex=1

🧭 풀이 시간

10분

👀 체감 난이도

✏️ 문제 설명

B개의 검은 공, W개의 흰 공, B개의 검은 상자, W개의 흰 상자가 있다.
당신은 모든 공을 상자에 담아서, 모든 상자가 정확히 한 개의 공을 담고 있도록 하고자 한다.

모든 공을 상자에 넣으면, 아래와 같이 각 상자마다 점수를 계산한다.
검은 상자에 검은 공이 들어 있으면 X점, 흰 상자에 흰 공이 들어 있으면 Y점, 검은 상자에 흰 공이 들어 있거나 흰 상자에 검은 공이 들어 있으면 Z점이다.

당신은 모든 상자의 점수의 합이 최대화되도록 공을 넣고자 한다. 이 때 얻을 수 있는 최대 점수를 구하는 프로그램을 작성하라.

🔍 풀이 방법

[사용한 알고리즘]

  • 완전 탐색

검은 공 c개를 흰색 상자에 넣는다면, 흰 공 c개도 반드시 검은 색 상자로 와야 한다.
이를 가지고 점수 구하는 식을 세우면, $2cZ + X(B-c) + Y(W-c)$이다.
c를 완탐으로 돌려서 최대 점수를 구하면 된다.

⏳ 회고

진영's pick 문제 재밌었다

@oncsr oncsr added the success 👍 해설을 보지 않고 풀었을 때 label Jun 6, 2025
@ShinHeeEul ShinHeeEul merged commit d3c244a into main Jun 6, 2025
1 check passed
@lkhyun
Copy link
Contributor

lkhyun commented Jun 10, 2025

ㄸㄸㄸㄸㄸㄸㄷ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants