Post Reply 
Interesting little loop optimization exercise
05-15-2015, 01:41 AM
Post: #3
RE: Interesting little loop optimization exercise
Well, we can place an immediate restriction on some of the coins.

We cannot have £1 or £2 because they exceed the maximum value.

We must have exactly one 50p. There is only one way to make the £1 using five smaller valued coins (5 x 20p) but this cannot satisfy the three make 30p requirement.

We've now got four unknown coins.

Both the 1p and 2p can be excluded since we don't have enough coins to bring them to a multiple of 5p which is required to hope to get to the 50p remainder.

So we're down to needing four coins from the 5p, 10p and 20p set that total 50p and have two three element subsets that total 40p and 30p.

A 5p coin needs a pair and two coins to make the remaining 40p. The only solution here can't make the 40p in three coins requirement. Thus we can't have a 5p coin.

I think we're down to the unique solution without any searching or looping Smile


Pauli
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Interesting little loop optimization exercise - Paul Dale - 05-15-2015 01:41 AM



User(s) browsing this thread: