[20250621] BOJ / G1 / 계단 수 / 이강현 #376
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/1562
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
N자리 수가 계단 수를 만족하고 0~9까지의 모든 숫자를 포함하는 경우의 수를 출력.
여기서 계단 수란, 수의 각 자리 숫자가 인접한 자리 숫자와의 차이가 1인 경우를 말한다.
🔍 풀이 방법
dp + 비트마스킹
N 자리수의 경우의 수는 N-1 자리 수에서 맨 끝자리가 0
9인경우를 모두 더하면 된다.9를 모두 포함하는 경우만 모두 더해 출력한다.여기에 비트마스킹을 적용하여 0
⏳ 회고
비트마스킹은 맨날 헷갈려