#include <iostream>
using namespace std;
int main(int argc, const char *argv[]) {
int n, k;
int h[100000];
int w[100000];
cin >> n >> k;
for (int i = 0; i < n; ++i) {
cin >> h[i] >> w[i];
}
int r = 100001;
int l=1;
int ans=0;
while (l<=r) {
int mid=(l+r)/2;
int cnt = 0;
for (int i = 0; i < n; ++i) {
cnt += (h[i] / mid) * (w[i] / mid);
}
if (cnt >= k) {
l=mid+1;
ans=mid;
}else{
r=mid-1;
}
}
cout<<ans<<endl;
return 0;
}
标签:巧克力,int,mid,cin,100000,ans
From: https://www.cnblogs.com/zh-ang-zhang/p/17879885.html