Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: puzzle: how many ways to make $100

by jdalbec (Deacon)
on Apr 29, 2006 at 15:10 UTC ( #546499=note: print w/ replies, xml ) Need Help??


in reply to Re^2: puzzle: how many ways to make $100
in thread puzzle: how many ways to make $100

Updates in bold below.

You have to change the original line

my @parts = (100, 50, 20, 10, 5, 1);
to match the allowed parts when comparing output. In your post (and TedPride's post) you allow $2 bills, so to get the same answer from my code you would change itthe original line above to
my @parts = (100, 50, 20, 10, 5, 2, 1);
and then the count matches. In blokhead's post, he uses coins instead of bills, so to get his answer you would change itthe original line above to
my @parts = (50, 25, 10, 5, 1);
and then the count matches.

Further update: My "original" and "change to" lines are not swapped. I'm using "original" and "change to" in reference to the code in my post above. I have added some text above to clarify which line is the "original" line and which lines are the "changed" lines.

There is a $2 bill. Just try finding one nowadays. Apparently the U.S. MintBureau of Engraving and Printing (thanks for the correction halley) is still printing them, but it must not be issuing large quantities because I almost never see one. I think it's unrealistic to expect to be able to make $100 with 50 $2 bills, for example.

Also, in the OP's $10 problem, $2 bills were not allowed:
It took them awhile, but they came up with the correct answer:
(1 ten), (2 5's), (1 5 and 5 1's), and (10 1's)


Comment on Re^3: puzzle: how many ways to make $100
Select or Download Code
Re^4: puzzle: how many ways to make $100
by GrandFather (Cardinal) on Apr 29, 2006 at 18:29 UTC

    Ah, stupid USA money. Us foreign devils what don't use American money aren't aware of the quirky distribution of the denominations of notes and the OP doesn't actually mention what is available.

    It is interesting to note that the addition of 2 dollar denomination increases the opportunity for making $100 by an order of magnitude.

    Minor point, your "original" and "change to" lines are swapped.

    Update later answers say there ought be a $2 bill. I stick by my original answer.


    DWIM is Perl's answer to Gödel
Re^4: puzzle: how many ways to make $100
by halley (Prior) on Apr 30, 2006 at 04:26 UTC
    There is a $2 bill. Just try finding one nowadays. Apparently the U.S. Mint is still printing them, but it must not be issuing large quantities because I almost never see one. I think it's unrealistic to expect to be able to make $100 with 50 $2 bills, for example.

    Just a total nit, but the US Bureau of Engraving and Printing makes the paper stuff in D.C.; the US Mint makes the coins in Denver and Philadelphia.

    If you visit the USBEP, or their website, you can order as many $2 bills as you like, even in odd collectables such as uncut sheets of multiple consecutively-numbered bills.

    --
    [ e d @ h a l l e y . c c ]

      Yes, except all the $2 uncut sheets are listed as "Temporarily out of stock." $2 "Single Star notes" (series 2003) are sold out. The $2 "Independence notes" (series 1995) appear to be available at $6.95 each. Making $100 with 50 of those will cost you $347.50. Plus tax, I expect.

        FYI I used to just go to the bank and ask for my money in $2 bills, never had any trouble getting them. I think they had to get them from somewhere besides their cash drawer though. ;)


        ___________
        Eric Hodges
        $2 bills used to be common in Canada up until maybe 10 years ago when they switched to a $2 coin with two different colours of metal known as a Twonie.
        You get currency from banks. Banks don't sell collectors items.
Re^4: puzzle: how many ways to make $100
by spiritway (Vicar) on May 01, 2006 at 13:46 UTC

    The two dollar bill is available from banks, like the $1 gold-colored coins. You find $2 bills at racetracks, mostly. People tend to avoid them, because they're so easy to mistake for $1 bills.

    Since the original problem omitted $2 bills, there doesn't seem any compelling reason to include them. But I submit that it's no less reasonable to make change with 50 $2 bills, as it is to do it with 100 $1 bills.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://546499]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2014-12-26 06:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (165 votes), past polls