P26855 [AtCoder] Penalty Game
提高-
题目描述

Problem Description

A-kun has a die that rolls an integer between $ L_1 $ and $ R_1 $ with equal probability.

B-kun has a die that rolls an integer between $ L_2 $ and $ R_2 $ with equal probability.

C-kun has a die that rolls an integer between $ L_3 $ and $ R_3 $ with equal probability.

Now, each of the three rolls their respective die, and the person with the lowest roll must receive a penalty game. However, if more than one person has the lowest roll, no one has to receive the penalty game.

Calculate the probability that A-kun will receive the penalty game.

Input Format

The input is given from the standard input in the following format:

$ L_1 $ $ R_1 $ $ L_2 $ $ R_2 $ $ L_3 $ $ R_3 $

Output Format

Output the probability that A-kun will receive the penalty game.
The answer will be considered correct if the absolute or relative error is less than $ 10^{-5} $.

Sample Input and Output

Sample Input #1

1 100
10 10
10 10

Sample Output #1

0.090000000000000

Sample Input #2

1 6
1 6
1 6

Sample Output #2

0.254629629629630

Sample Input #3

2212 3741
1725 2601
1644 2479

Sample Output #3

0.009579046784

Notes/Hints

Constraints

  • $1 \leq L_1 \leq R_1 \leq 100,000$.
  • $1 \leq L_2 \leq R_2 \leq 100,000$.
  • $1 \leq L_3 \leq R_3 \leq 100,000$.
  • All inputs are integers.

Partial Points

This problem is divided into several sub-tasks, and you will be considered to have solved a sub-task if you correctly answer all test cases in that sub-task.
The score for your submission will be the sum of the points for the sub-tasks you solved.

  1. (16 points) $ L_2 = R_2 = L_3 = R_3 = 10 $.
  2. (35 points) $R_1, R_2, R_3 \leq 200$.
  3. (29 points) $R_1, R_2, R_3 \leq 4,000$.
  4. (20 points) No additional constraints.

Sample Explanation 1

If A-kun's die roll is one of $ 1, 2, 3, 4, 5, 6, 7, 8, 9 $, he must receive the penalty game. The probability of this happening is $\frac{9}{100} = 0.09$.

Sample Explanation 2

For example, if A-kun's die roll is $ 2 $, B-kun's die roll is $ 3 $, and C-kun's die roll is $ 6 $, A-kun must receive the penalty game.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 100 10 10 10 10
样例输出
0.090000000000000