Football rivalry (2)

Two long-time rival football teams, let us call them B (for beautiful
manners) and M (for miserable — very, very miserable — manners), are
playing again. Both teams are exhausted, so the first to score a goal
will win the game for sure. At this moment, team B has the ball. If they
decide to attack, there is a probability w_(B) that they manage to
score, thus winning the game. Hovewer, with probability ℓ_(B) they will
receive a goal, thus losing the game. With probability 1 − w_(B) − ℓ_(B)
they will just lose the possesion of the ball. Team B has another
option: to pass the ball around. In that case, the possesion of the ball
will eventually go to team M. Then we will have a simmetrical situation:
If team M goes for an attack, they will immediately win with probability
w_(M), they will immediately lose with probability ℓ_(M), and the ball
will go back to team B with probability 1 − w_(M) − ℓ_(M). If they
decide to just pass the ball and wait, eventually the possesion of the
ball will go back to team B.

0.55

Given w_(B), ℓ_(B), w_(M) and ℓ_(M), and assuming that both teams take
the best decisions (to attack or not to attack) and that team B has the
ball now, which is the probability that team B will win?

Input

Input consists of several cases, each one with four real numbers w_(B),
ℓ_(B), w_(M) and ℓ_(M) between 0 and 1. Assume w_(B) + ℓ_(B) ≤ 1 and
w_(M) + ℓ_(M) ≤ 1.

  0.45

[image]

Output

For every case, print the probability that team B will win with four
digits after the decimal point. (The input cases have no precision
issues.) A situation where no goal will be scored (an eternal tie) is
similar to a fifty-fifty situation. Consequently, print “0.5000” in this
case.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T12:06:28.100Z

© Jutge.org, 2006–2026.
https://jutge.org
