We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #84: Monopoly odds
Project Euler #84: Monopoly odds
Sort by
recency
|
10 Discussions
|
Please Login in order to post a comment
Can anyone please tell me where is my fault only 1 testcase was passed...
Just to bump this to the top of the comments section. https://www.hackerrank.com/NiakTheWizard comment below saved me You can get a chance move back 3 spaces that then hits the community chest. I didn't think this was how monopoly worked but anyway. This should be noted in the question i feel.
Also the fact that the cards go back on the bottom of the deck implies that maybe you have to worry about the order of the cards and can't do markov chains. But that is just false information and should be removed from the question. Assume the decks are shuffled after each draw
Successively approximation is superb for this problem. I got this idea from thinking about Newton Raphson and chemical equilibrium. Start with an initial arbitrary (in my case, all
0.025
) list of probabilities (probability of the player standing on this corresponding square at the end of the last round).Use another list to accumulate the probabilities of the player ending up standing in each square which are generated in this round, by iterating each of the squares. Divide them by a common divisor to make sure their sum is . After certain approximating iterations we would end up with a fairly stable list of probabilities.
I picked approximating iterations for any input, and it passes all test cases within 0.08s. That's Python.
Where can we download what are the input and output for the additional test cases? can't figure out.
When i was assuming this i got wa. When I has assumed that we take independet random card I got AC. May be it will be helpfull.