Help me in solving MONSTER2 problem

My issue

Can someone tell me when case did i miss, its almost right, i tried to determine the number of moves in the beginnning and then simulated the game for n moves.

My code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(a) a.begin(),a.end()

int main() {
	int t=1;
	cin >> t;
	while(t--)
	{
	   long long A,B,X,Y;
	   cin >> A >> B >> X >> Y;
	   long long moves = (B) / Y;
	   if (X * moves <= (A + moves*Y))
	   cout << 0 << endl;
	   else
	   cout << 1 << endl;
	}
	return 0;
}

Problem Link: CodeChef: Practical coding for everyone

@nikith_ganga
This is my code . Hope u will get the logic . Have written in much simpler way.

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int a,b,x,y;
	    cin>>a>>b>>x>>y;
	    if(y-x>=0)
	    cout<<0;
	    else
	    {
	        int d=ceil(a*1.0/(x-y)*1.0);
	        int x=ceil(b*1.0/y*1.0);
	        if(d<x)
	        cout<<1;
	        else
	        cout<<0;
	    }
	    cout<<endl;
	}
	return 0;
}

Thanks a lot…