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;
}