[Gold I] Title: K번째 수, Time: 744 ms, Memory: 34536 KB -BaekjoonHub

This commit is contained in:
SSUM
2025-03-08 01:06:01 +09:00
parent 6c45265468
commit 363f95a9b9
2 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import math
import sys
n = int(input())
k = int(input())
start = 1
end = k
result = 0
while start <= end:
mid = int((start + end)/2)
tot = 0
for i in range(1, n+1):
tot += min(mid // i, n)
if tot < k:
start = mid +1
else:
result = mid
end = mid -1
print(result)

View File

@@ -0,0 +1,30 @@
# [Gold I] K번째 수 - 1300
[문제 링크](https://www.acmicpc.net/problem/1300)
### 성능 요약
메모리: 34536 KB, 시간: 744 ms
### 분류
이분 탐색, 매개 변수 탐색
### 제출 일자
2025년 3월 8일 01:05:30
### 문제 설명
<p>세준이는 크기가 N×N인 배열 A를 만들었다. 배열에 들어있는 수 A[i][j] = i×j 이다. 이 수를 일차원 배열 B에 넣으면 B의 크기는 N×N이 된다. B를 오름차순 정렬했을 때, B[k]를 구해보자.</p>
<p>배열 A와 B의 인덱스는 1부터 시작한다.</p>
### 입력
<p>첫째 줄에 배열의 크기 N이 주어진다. N은 10<sup>5</sup>보다 작거나 같은 자연수이다. 둘째 줄에 k가 주어진다. k는 min(10<sup>9</sup>, N<sup>2</sup>)보다 작거나 같은 자연수이다.</p>
### 출력
<p>B[k]를 출력한다.</p>