All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Pocket Change (Posted on 2013-07-30)
A friend of mine, Sol announces that he has a number of coins in his pocket that add up to precisely one dollar. When he tells me how many coins he has, I ask if any one of them is a half-dollar. Sol tells me "no". I realize that I can't tell for sure what coins he has, because there are six different combinations that produce precisely one dollar.

How many coins does Sol have in his pocket?

 See The Solution Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: computer solution - the program Comment 5 of 5 |
(In reply to computer solution by Charlie)

DIM num(100)
amt = 100
FOR q = 0 TO 4
amt = amt - 25 * q
FOR d = 0 TO amt / 10
amt = amt - d * 10
FOR n = 0 TO amt / 5
amt = amt - 5 * n
p = amt
PRINT USING "####"; q; d; n; p; q + d + n + p
num(q + d + n + p) = num(q + d + n + p) + 1
amt = amt + 5 * n
NEXT
amt = amt + d * 10
NEXT
amt = amt + 25 * q
NEXT
FOR i = 1 TO 100
IF num(i) = 6 THEN PRINT i
NEXT

Then the output was sorted on total coins.

 Posted by Charlie on 2013-07-30 16:24:39

 Search: Search body:
Forums (0)