here is my code
#include
#include
#include
using namespace std;
bool isPossible(int n , int m ,int x , int y , int mid)
{
if((mid*x)<=(m+(n-mid)*y))
return true;
else
return false;
}
int max_students(int n , int m , int x , int y)
{
int s=0,max_s=INT_MIN;
int e=n;
while(s<=e)
{
int mid=(s+e)/2;
if(isPossible(n,m,x,y,mid))
{
max_s=max(max_s,mid);
s=mid+1;
}
else
e=mid-1;
}
return max_s;
}
int main()
{
int n , m, x,y;
cin>>n>>m>>x>>y;
cout<<max_students(n,m,x,y)<<endl;
}
its not passing all test cases . please help
