思路
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e5+10;
int n,k;
int h[N],w[N];
bool check(int u)
{
int res=0;
for(int i=0;i<n;i++)
{
res+=(h[i]/u)*(w[i]/u);
if(res>=k) return true;
}
return false;
}
int main()
{
cin>>n>>k;
for(int i=0;i<n;i++) cin>>h[i]>>w[i];
int l=0,r=1e5;
while(l<r)
{
int mid=l+r+1>>1;
if(check(mid)) l=mid;
else r=mid-1;
}
cout<<l<<endl;
return 0;
}