#include<bits/stdc++.h>
using namespace std;
int n;
long long a[100000],b[100000],k;
int main()
{
cin >> n>>k;
for(int i = 0;i < n;i++)
{
cin >> a[i];
}
for(int i = 0;i < n;i++)
{
cin >> b[i];
}
long long l = 0,r = 10000000000;
while(l+1<r)
{
long long m = (r-l)/2+l;
long long k1 = k;
for(int i = 0;i < n;i++)
{
if(b[i]/m<a[i])
{
if(a[1]>100000)
{
k1-=(a[i]-b[i]/m)*m;
}
else
{
k1-=a[i]*m-b[i];
}
}
}
if(k1 < 0)
{
r=m;
}
else
{
l=m;
}
}
cout << l;
return 0;
}
10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
1 1 1 1 1 1 1 1 1 1
结果为0
过程中cout<<k1;调试
2 个赞