In Levikland, there are coins worth 1, 2, 5, 10, 20, 50 and 100 perplexii. A has twice as much money as B, who has twice as much as C, who has twice as much as D. How can this be, if everybody has two coins?
a=120 (100+20)
b=60 (50+10)
c=30 (20+10)
d=15 (10+5)
Pretty simple just with process of elimination. Start with the highest possible combination (200) and work down to find one divisible by 2, 4 and 8. check if they can be made with 2 coins and viola
Btw penny, someone had to write the VB script so all in all process of elimination is probably quicker in a once off ;)
|
Posted by Urza
on 2004-11-21 14:49:52 |