Please help in codechef june lunchtime 2020 chef and demonitisation problem

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 -

  1. When s is equal to n, but s is odd. You will require more than 1 coin.
  2. 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

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

Check it out

1 Like

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.

  1. but when s is equal to n, s is even. because, n can’t be odd.
  2. 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.