GDOG - Editorial

// here is my code you can try
void solve()
{
// your code goes here
int a,b,coine=0; cin>>a>>b;
for(int i=1;i<=b;i++)
{
coine=max(coine,a%i);
}
cout<<coine<<endl;
}

i think this is not right because if you give 20 and 5 then it will give result "20%4 = 0 " which is not right because if we choose 3 ans would be “20%3=2”.Please clear my doubt

In the second testcase if tanzim called 7 people then wouldn’t he get 4 coins to himself?

Test cases

2
5 2
11 3

In the second given case Tuzik can only call 3 people because that’s his maximum bark.

But if his maximum bark were 7 in that case, the best bark would call only 6 people to give him 5 coins.