[20250404] BOJ / G5 / 빌런 호석 / 김수연 #295
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/22251
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
호석이가 디스플레이의 LED 중에서 최소 1개, 최대 P개를 반전시키려고 한다.
반전 이후 층은 1 이상 N 이하가 되어야하며,
현재 엘리베이터는 X층에 멈춰있다.
🔍 풀이 방법
digit 배열에 각 숫자로 바꾸려고 할 때 반전시켜야 하는 LED의 갯수 저장해두고,
dfs로 재귀를 돌면서 조건을 만족할 때, answer를 증가시킨다.
⏳ 회고
간단하게 생각하면 되는데, 괜히 복잡하게 생각해서 시간을 많이 잡아먹었다.