How to solve this question?

can’t understand what to solve in this question?? how to use binary search in it?

This is very similar to aggresive cows/books allocation problem.There is a standard way to solve these type of problem.You can use binary search to solve this.
Here,first you need to identify the maximum and minimum value possible.Then see if mid((maximum value+ minimum value)/2) satisfies the condition or not.if condition is satisified, check for greater value than mid else check for smaller value than mid.

#include<bits/stdc++.h>
using namespace std;
#define li long long int

bool check(li n,li m,li x,li y,li mid){
li val1 = mid*x;
li val2 = m + (n-mid)*y;
if(val1<=val2){
return true;
}
return false;

}

li ans(int n,int m,int x,int y){
li start = 0;
li end = n;
li ans = -1;
while(start<=end){
li mid = (start+end)/2;
bool check1 = check(n,m,x,y,mid);
if(check1==true){
ans = mid;
start = mid + 1;
}else{
end = mid - 1;
}
}

return ans;

}

int main() {
li n;
cin>>n;
li m;
cin>>m;
li x;
cin>>x;
li y;
cin>>y;
cout << ans(n,m,x,y) << endl;
}