#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<algorithm>
using namespace std;
#define eps 1e-7
#define maxi 50005
long long h[maxi];
long long hi[maxi];
long long n,a,b;
long long in=10000000000;
bool C(long long x){
long long t=x;
for(long long i=0;i<n;i++)
hi[i]=h[i];
for(long long i=0;i<n;i++){
hi[i]-=x*b;
if(hi[i]<=0) continue;
long long y;
if(hi[i]%(a-b)==0)
y=hi[i]/(a-b);
else
y=hi[i]/(a-b)+1;
t-=y;
}
if(t>=0) return true;
return false;
}
void solve(){
sort(h,h+n);
long long lb=0,ub=in;
while(ub-lb>1){
long long mid=(lb+ub)/2;
//cout<<mid<<" "<<C(mid)<<" "<<ub<<endl;
if(C(mid)) ub=mid;
else lb=mid;
//cout<<lb<<" "<<ub<<endl;
}
cout<<ub<<endl;
}
int main()
{
scanf("%d%d%d",&n,&a,&b);
for(int i=0;i<n;i++) scanf("%d",&h[i]);
solve();
return 0;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:45:35: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
scanf("%d%d%d",&n,&a,&b);
^
./Main.cpp:45:35: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=]
./Main.cpp:45:35: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘long long int*’ [-Wformat=]
./Main.cpp:46:42: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
for(int i=0;i<n;i++) scanf("%d",&h[i]);
^
./Main.cpp:45:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d",&n,&a,&b);
^
./Main.cpp:46:43: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attri...