[20251010] BOJ / G5 / 감소하는 수 / 이준희 #1080
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/1038
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
큰 자릿수 부터 작은 자릿수까지의 수가 전부 감소한다면 그 수를 감소하는 수라고 합니다.
ex) 321, 9876543210 등
N이 주어졌을 때 N번째 감소하는 수를 출력하는 문제입니다.
🔍 풀이 방법
DFS를 이용하여 풀었습니다.
0 ~ 9 까지 중의 숫자 하나가 가장 큰 자릿수인 경우로 시작하는 방식으로 구현했습니다.
예를들면 dfs(5,1) 인 경우 5, 50, 51, 52, 53, 54, 510, 520, 521 ... 이런식으로 구할 수 있도록 dfs를 구현했습니다.
⏳ 회고
처음에는 숫자가 말도안된다고 생각해서 손을 못대고 있다가 감소하는 수가 한계가 있다는 것을 생각해내는데 시간이 좀 걸렸던 것 같습니다.