can anyone please have a look at my solution for the chfmot18 problem? Below is the link to my solution:

https://www.codechef.com/viewsolution/34769356

Thank you so much!

can anyone please have a look at my solution for the chfmot18 problem? Below is the link to my solution:

https://www.codechef.com/viewsolution/34769356

Thank you so much!

1 Like

Following are the conditions that you are not considering correctly -

- When s is equal to n, but s is odd. You will require more than 1 coin.
- When remainder of s % n is 1. You will only need 1 more coin.

1 Like

Your first obs is wrong as i have guaranteed than N is even

2 Likes

yesâ€¦N is always even, but s can be odd

1 Like

easiest solution

Note that you have written S=N.

Now S and N have same parity.

- but when s is equal to n, s is even. because, n canâ€™t be odd.
- i got the 2nd point.

Thank you so much!

yes, I got the 2nd point.

Thank you so much!

yes, I checked it.

Thank you so much!

yesâ€¦got it. My bad.

yesâ€¦right. Thanks for pointing it out.