thats my code for this problem.

#include

using namespace std;

int main() {

int t;

cin>>t;

while(t–)

{

long n,k;

cin>>n>>k;

cout<<n%k<<endl;

}

```
return 0;
```

}

thats my code for this problem.

#include

using namespace std;

int main() {

int t;

cin>>t;

while(t–)

{

long n,k;

cin>>n>>k;

cout<<n%k<<endl;

}

```
return 0;
```

}

its not necessary always that for k we get the max coins left out for dog.

Like for example ,10 5 so according to your code the dog shall get 0(10%5)coins but if we keep k==4,then the coins the dog will get will be 2(10%4=2)

1 Like

Because you have interpreted the problem statement wrongly, specifically the following statement from the problem:

You can assume that he can choose to call any number of people, from a minimum of

1, to a maximum ofK.

However, the problem is simply asking you to find the maximum remainder you can get when you divide N by i where i \in [1, K].

1 Like

tanx