10491 - Cows and Cars
You are to find the probability of winning a car given that when you have picked a door, the contest presentor will open n doors with cows and you will choose another door.
Looking at the above description, problem can be split into 2 subcases. 1. Finding P(cow 1st & car 2nd) 2. Finding P(car 1st & car 2nd)
Derive a formula and you will be able to solve this question. It is one of the shortest code I have seen.
2 1 1 5 3 2 2000 2700 900
0.66667 0.52500 0.71056