12806 - Grand Tichu!

All about problems in Volume 128. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
alexhighviz
New poster
Posts: 3
Joined: Fri Nov 21, 2014 4:00 am

Re: 12806 - Grand Tichu!

Post by alexhighviz » Wed Dec 03, 2014 2:56 pm

I am looking at the sample input and output given for this problem and am confused about the last entry.

The input is: PdM234AA
and the output: ... (chance of winning <= 0.25)

As far as I can see, there are two ways to get a winning combination.

1. Pick up the D, to get PDdM
2. Pick up an A, to get PAAA

In total there are 56 cards, I already have 8 so there are 48 remaining. I already have 2 A's so there are 2 A's remaining and there is one D. So there are 3 winning cards and 45 losing cards.

The chance of getting a winning card in the first go is 3/48, and the chance of getting a losing card is 45/48
The chance of getting a losing card 6 times in a row is (45/48)*(44/47)*(43/46)*(42/45)*(41/44)*(40/43) = (45! / 39!) / (48! / 42!) = 0.66
So the chance of winning is 1 - 0.66 = 0.34 which is greater than 0.25

Does the example give the wrong answer?

UPDATE:

I got to an Accepted solution by solving the following P(PDdM) > 0.25 || P(PAAA) > 0.25 ||P(PDA) > 0.25 || P(DAA) > 0.25
The question however asks for P(PDdM || PAAA || PDA || DAA) > 0.25

It is frustrating when the accepted answer is the wrong one.

jurajz
Learning poster
Posts: 69
Joined: Sat Sep 02, 2006 7:30 pm
Location: Slovakia

Re: 12806 - Grand Tichu!

Post by jurajz » Sun Dec 14, 2014 5:42 pm

Hi alexhighviz, I agree with you.

I have to submit wrong program, when I want get "Accepted".

In fact, it is not needed "dM" in input. It is enough to have Phoenix and just two aces in the first eight cards and all we need is Dragon, because of the first or second case of winning (D, P, A+ or D, 2A+).

When we have P and two aces in the first 8 cards, then we need only Dragon, or at least one ace (or both) in the remaining 6 cards. And the probability of this case is 0,336262719, much more than 0.25.

Post Reply

Return to “Volume 128 (12800-12899)”