Still the best...
David A. Bandel
david
Mon May 17 11:33:44 PDT 2004
On Sat, 22 Jun 2002 18:51:06 -0700
begin "Kevin O'Gorman" <kevin at kosmanor.com> spewed forth:
[snip]
> In fact, I calculate (this the help of my local friendly Linux machine)
> that there are exactly 240 ways to do it. It's very simple to do; just
> try 0-4 quarters, then 0 to some number of dimes (depending on how many
> quarters), 0 to some number of nickels, and pennies to fill out the
> buck. Here's what it looks like in Python:
>
> #!/usr/bin/python
> w = 0
> for q in range(0,5):
> for d in range(0,10):
> if q*25+d*10>100: break
> for n in range (0,20):
> if q*25 + d*10 + n*5 > 100: break
> w = w + 1
> print \
> "%2.2d quarters, %2.2d dimes, %2.2d nickels, %3.3d pennies: %d ways"
> \
> % (q, d, n, 100- q*25 - d*10 - n*5, w)
>
>
Please grep your output for:
20 nickels
10 dimes
and there?s a number of others missing. Last time I looked, the above 2
were legitimate ways to change a dollar.
Just by inspection, 240 cannot be the correct number. The number will be
odd.
[snip]
--
Focus on the dream, not the competition.
-- Nemesis Racing Team motto
More information about the Linux-users
mailing list