[20250923] BOJ / G3 / Number Reduction / 권혁준 #960
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/34490
🧭 풀이 시간
10분
👀 체감 난이도
✏️ 문제 설명
정수에 포함되어 있는 숫자 중 그 정수를 나눌 수 있는 2 이상의 숫자가 있다면, 그 숫자로 정수를 나눈다.
정수 k에 이 작업을 반복해서 1로 만들 수 있다면 이 정수를
valid하다고 한다.N이 주어지면, 1부터 N까지의 정수 중
valid한 수의 개수를 구해보자.🔍 풀이 방법
1부터 10^9까지 valid한 수를 다 출력해봤는데, 개수가 2400개 밖에 없었다.
그래서 처음에 1에서 시작해서 백트래킹으로 valid한 수들만 set에 담도록 한 뒤 마지막에 set의 크기를 출력해줬다.
⏳ 회고
ez