Re: 12806 - Grand Tichu!
Posted: 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.
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.