volume ml. The cook serves portions, each time picking one of four ladles at random with equal probability 1/4:
- 100 ml from A and 0 ml from B;
- 75 ml from A and 25 ml from B;
- 50 ml from A and 50 ml from B;
- 25 ml from A and 75 ml from B.
If a pot holds less than the ladle calls for, whatever is left is poured out. Serving stops as soon as at least one pot is empty.
Return the probability that A runs dry before B, plus half the probability that both run dry at the same time. Answers within 10⁻⁵ of the exact value are accepted.volume=25 → 0.625
Every ladle empties pot A. In three cases out of four pot B empties at the same moment (counted as one half); with the 100/0 ladle B still has soup: 0.25 · (1 + 0.5 + 0.5 + 0.5) = 0.625.
volume=75 → 0.65625
Now several servings can happen in a row; summing over all outcomes with their probabilities gives 0.65625.
volume=0 → 0.5
volume ≤ 10⁹volume=25
0.625
Run checks the first 3 tests in your browser. Submit checks all 55 tests on the server, hidden ones included.