[20250917] BOJ / G4 / DSLR/ 이준희 #909
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/9019
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
4자리수의 십진수가 있고 D, S, L, R 읭 4가지 연산 방법이 있을 때
정수 A를 이용하여 B를 만들 수 있는 가장 짧은 연산 방법을 구하는 문제입니다.
🔍 풀이 방법
각 D, S, L, R 의 로직을 구현하고 BFS를 활용하여 풀었습니다.
4자리 수이기 때문에 10000짜리 방문배열을 선언하여 방문처리를 하고
int와 그 int까지 도달하는데 사용한 연산을 저장하는 String을 인자로 갖는 node를 선언하여 이를 이용했습니다.
⏳ 회고
문제 풀이 방식은 굉장히 쉬운 접근법이었는데, 경로를 추적하는 방식을 오래 고민했습니다.