Stupid people

The current pandemic has proven (once again) how many stupid people
there are. Consider, for instance, the use of face masks, under this
simplified model: The length of a face is ℓ, with the bottom of the chin
at position 0 and the top of the front at position ℓ. The bottom of the
mouth is at position m, and the top of the nostrils is at position n,
with 0 < m < n < ℓ.

Let us consider that a placement of a mask is defined by two real
numbers: its bottom position b ≥ 0 and its upper position u ≤ ℓ, where
b < u. We say that a placement is reasonable if it completely covers the
mouth and the nostrils, that is, if b ≤ m and u ≥ n.

A stupid person just choses any possible placement such that
0 ≤ b < u ≤ ℓ uniformly at random. Note that b and u are real numbers
with an arbitrary (or infinite) number of decimals. What is the
probability that a stupid person wears a mask in a reasonable way?

Input

Input consists of several cases, each with three real numbers m, n and
ℓ. You can assume 0 < m < n < ℓ ≤ 10⁶.

Output

For every case, print the probability that a stupid person wears a mask
in a reasonable way. Print four digits after the decimal point. The
input cases do not have precision issues.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:18:20.049Z

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