In Dingistan the coins are of the following denomination:
SILVER:
10, 15, and 20 dingos
COPPER:
1, 2, and 3 dingos.
The ACMs (automatic change machines) accept silver coins and return change as follows:
20d=(15+2+2+1) d
15d=(10+2+2+1) d
10d=(3+3+2+2) d
After Dingus converted into copper the 145d he had in silver coins, his friend W.G.Ringus counted them and successfully reconstructed the original composition of silver coins, previously unknown to him.
It is up to you to find both the input and the output
- if the Wise Guy did it – you can do it, too.
It is D4, if solved analytically.
(In reply to
re: Analytical solution (spoiler) (D2) by Ady TZIDON)
Ady:
Thanks for the kind words.
I almost left that first observation out, because it leads to one, not necessarily the sole solution. The problem would have been a little better, I think, if the total number of coins could not be determined by looking at just one denomination.
For instance, if
20d = 4*3c + 4*2c
15d = 2*3c + 3*2c + 3*1c
10d = 2*2c + 6*1c
At any rate, the stronger approach also does not require comparison of distinct partitions. It is based on my 2nd observation: "starting with 1 10d and 1 20d gives the same change as starting with 2 15d's".
That means that the starting configuration cannot have more than one 15d. Because it must have an odd number of 15d's it must have exactly one 15d. It also means that the remaining 130d must be all 10d or all 20d coins. 130 is not evenly divisible by 20, so there must be 13 10d's. So that is clearly the only solution. And it is also the solution to my modified problem above, using the exact same argument.
Edited on October 12, 2017, 7:18 pm