Stupid people P45462


Statement
 

pdf   zip

thehtml

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 bm and un.

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 < ℓ ≤ 106.

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.

Public test cases
  • Input

    10 15 20
    1.62 2.72 3.14
    1 2 3
    

    Output

    0.2500
    0.1380
    0.2222
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++ Python