[20250919] BOJ / G1 / K번째 수 / 이강현 #926
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/1300
🧭 풀이 시간
120분
👀 체감 난이도
✏️ 문제 설명
B[i][j] = i*j 일때, 배열 B에 있는 모든 값들을 오름차순 정렬함.
그리고 K번째 값을 구하라.
🔍 풀이 방법
이분탐색
N이 100000이므로 1부터 100억까지의 범위에서 이분 탐색함.
그리고 mid보다 작은 것들의 개수를 구함.
모든 값은 N이하의 값들의 곱으로 나타나므로 N부터 나눠보면서 그 몫이 mid보다 작은 것들의 개수가 됨.
이때 몫이 N보다 큰 경우는 최대 N개만큼만 더해지도록 예외처리 해줌.
⏳ 회고
병규와 혁준이와의 이야기를 통해 아이디어를 얻었다. 혼자였으면 못풀었을 것 같다.