import java.util.Scanner;
public class Main {
public static int N = 0;
static int K = 0;
static int[] H = new int[100000];
static int[] W = new int[100000];
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
N = scan.nextInt();
K = scan.nextInt();
for (int i = 0; i < N; i++) {
H[i] = scan.nextInt();
W[i] = scan.nextInt();
}
int l = 1, r = (int) 1e5;
while (l < r) {
int mid = (l + r + 1) >> 1;
if (find(mid)) {
l = mid;
} else {
r = mid - 1;
}
}
System.out.println(l);
}
//获得的巧克力块数最大块数
public static boolean find(int mid) {
int sum = 0;
for (int i = 0; i < N; i++) {
sum += (H[i] / mid) * (W[i] / mid);
if (sum >= K) return true;
}
return false;
}
}
分巧克力-二分
最新推荐文章于 2024-08-19 16:01:20 发布