UVa 10491 - Cows and Cars

10491 - Cows and Cars
http://acm.uva.es/p/v104/10491.html

Summary
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.

Explanation
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.

Sample Input
2 1 1 5 3 2 2000 2700 900

Sample Output
0.66667 0.52500 0.71056