2 test cases failed in the problem (winning cb scholarship!)

I tried to solve by using this approach , bur unfortunately 2 of my test cases failed … can you suggest some changes in this code ?

#include
#include
using namespace std;

int main(){

 long int n , m , x , y ;
cin >> n >> m >> x >> y;

 long int member = 0 , count = 0 ;

while(member<n){

	while(m-x>=0)
	{
		m=m-x;
		count++;
		member++;

	}
	m=m+y;
	member++;
}

cout << count << endl;

}

hi @aggarwal.naman21
refer this -->

I know the logic behind binary search , but i wanted to know what makes this code fail two test cases?

so basically u cant do like the way u are doing… approach is not correct…

@aggarwal.naman21
is there anything else??

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.