第八届蓝桥杯
# include <bits/stdc++.h>
using namespace std;
//经典二分
const int N = 1e5 + 10;
int n, k;
int a[N], b[N];
int check(int mid)
{
long long res = 0;
for(int i = 0; i < n; i++)
{
res += (long long) a[i]/mid * (b[i]/mid);
if (res > k) return true;//优化 防止超时
}
return false;
}
int main()
{
cin >> n >> k;
for(int i = 0; i < n; i++) scanf("%d%d", &a[i], &b[i]);
int r = 1e5, l = 1;
while (r > l)
{
int mid = r + l + 1 >> 1;
if(check(mid)) l = mid;
else r = mid - 1;
}
printf("%d", r);
return 0;
}