显示代码纯文本
#include<algorithm>
#include<cstdio>
#include<iostream>
using namespace std;
int n,x,b,a[500010],c[500010];
int l=0,r=5000000;
void find();
int m()
{
freopen("dry.in","r",stdin);
freopen("dry.out","w",stdout);
scanf("%d%d%d",&n,&x,&b);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
find();
return 0;
}
void find()
{
int ans=0;
int temp;int best=0x7ffffff;
for(int i=1;i<=n;i++)
{
c[i]=(a[i]+x-1)/x;
}
while(l<=r)
{
ans=(l+r)/2;
temp=0;
for(int i=1;i<=n;i++)
{
if(c[i]>ans)
{
temp+=(a[i]-ans*x+b-1)/b;
}
}
if(temp<=ans)
{
if(ans<best) best=ans;
r=ans-1;
}
else l=ans+1;
}
printf("%d",best);
}
int k=m();
int main()
{
;
}