Interesting little loop optimization exercise
05-15-2015, 01:41 AM
Post: #3
 Paul Dale Senior Member Posts: 1,752 Joined: Dec 2013
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

Pauli
 « Next Oldest | Next Newest »

 Messages In This Thread Interesting little loop optimization exercise - Dave Britten - 05-14-2015, 08:27 PM RE: Interesting little loop optimization exercise - Jim Horn - 05-15-2015, 01:10 AM RE: Interesting little loop optimization exercise - Paul Dale - 05-15-2015 01:41 AM RE: Interesting little loop optimization exercise - Katie Wasserman - 05-15-2015, 01:09 PM RE: Interesting little loop optimization exercise - Paul Dale - 05-15-2015, 01:42 AM RE: Interesting little loop optimization exercise - Dave Britten - 05-15-2015, 02:29 AM

User(s) browsing this thread: 1 Guest(s)