No Change Required February long challenge

For the question no change required in february long challenge my solution was as below.
1.if any one of the coin (d) has value which doesn’t divide the amount to be paid in total (p) then the set of coins with one more coin then p/d coins is required solution.
2. otherwise check if all coins smaller than coin d divides it. If this is satisfied then print NO. Check this for all the coins.
3. otherwise required output will be
p/d - 1 no. of that coin
d/(smaller coin that doesn’t divide d) +1 no of smaller coin.
rest all zero.

I am unable find where is it going wrong. Below is my solution for the same.
[my solution]
(CodeChef: Practical coding for everyone)

Hello rioname
have you check this case
1
2 24
3 8

if we take 2 8rs coin and rest 3rs coin we have to pay extra…
i hope your doubt has been cleared now… :slight_smile:

I have gone through your solution and i found that your solution is too complex so i can’t say anything .
Here is my solution hope you will figure it out what’s wrong in your code CodeChef: Practical coding for everyone

1
4 56
7 14 28 56

Check this test case.
o/p–> NO

gave the input
1
2 24
3 8
output - YES 3 2

I tried second input as well.
output- NO

Both of which are as expected.

Read the question properly.

The Output for the testcase given be @anon84572196, is NO, and not YES. It is stated in the question statement clearly why is the answer so.