On Sat, 22 Jun 2002 18:51:06 -0700 begin "Kevin O'Gorman" <[EMAIL PROTECTED]> 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 _______________________________________________ Linux-users mailing list - http://linux-sxs.org/mailman/listinfo/linux-users Subscribe/Unsubscribe info, Archives,and Digests are located at the above URL.