[thechat] Programming Problem
Beau Hartshorne
beau at members.evolt.org
Fri Nov 9 13:04:47 CST 2001
Oops... I think it's:
(13*12*11*10)*4 = 68640
For all the different ways to draw the 13 different cards from the deck
with no regard to suits.
Beau
> -----Original Message-----
> From: thechat-admin at lists.evolt.org
> [mailto:thechat-admin at lists.evolt.org] On Behalf Of Beau Hartshorne
> Sent: November 8, 2001 9:14 PM
> To: thechat at lists.evolt.org
> Subject: RE: [thechat] Programming Problem
>
>
> > the number of distinct combinations of four cards drawn from
> > a playing card deck is 52*51*50*49 = 6,497,400
> >
> > if you disregard suits, there are fewer combos, but i can't
> > be bothered counting them -- you can't just divide 6,497,400
> > by 4, because there's only one hand with all sevens, but 144
> > different hands with two sevens and two eights.... urggle...
>
> 13*12*11*10 = 17160 if suits don't count.
>
> What I wanted to do was write a program that could take 4
> numbers as input, then output all the different ways that
> they successfully add/multiply/divide/subtract to 24 -- not
> something that just spat out every single possible
> combination of cards and operators. The program would have to
> try every single possible combination of operators and
> parenthesis to find all the cases where the four numbers
> input would add to 24. If it was written in C or even Java,
> this would take a few seconds for the computer to solve, at the most.
>
> > if the number of operators is 4, and they don't have to be
> > distinct, then there are 4**3 = 64 ways of combining four
> > cards (i.e. using three infix operators), but then the
> > possibility of parentheses throws everything into a cocked hat
>
> Are there any other ways to arrange the parentheses (where it
> would affect the order of operations):
>
> ((a-b)-c)-d
> (a-(b-c))-d
> (a-b)-c-d
> (a-b-c)-d
> (a-b)-(c-d)
> a-(b-c)-d
> a-((b-c)-d)
> a-(b-(c-d))
> a-(b-c-d)
> a-b-(c-d)
>
> Where each "-" represents some operator. If those are the
> only ways to arrange the parentheses, then the program just
> needs to iterate through every possible combination of
> operators, and every possible order of operands to solve the problem.
>
> Beau
>
>
> _______________________________________________
> thechat mailing list
> thechat at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/thecha> t
>
http://lists.evolt.org/thechatarchive/
________________
"You know what happens if you spill Clynelish?"
"No, what?"
"You go directly to hell"
More information about the thechat
mailing list