P26300 [AtCoder] Dice Game
提高
题目描述

Problem Description

There are red and blue (six-sided) dice. When the red die is rolled, the probability of rolling an $i$ is $p_i$ percent, and when the blue die is rolled, the probability of rolling a $j$ is $q_j$ percent.

Petr and tourist are playing the following game. Both players know the probability distributions of both dice. First, Petr chooses one die of his choice (without informing tourist) and rolls it, then tells tourist the result. Next, tourist guesses the color of the chosen die. If tourist guesses the color correctly, tourist wins; otherwise, Petr wins.

Determine the probability that tourist wins when both players act optimally.

Input Format

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

$ p_1 $ $ p_2 $ $ p_3 $ $ p_4 $ $ p_5 $ $ p_6 $ $ q_1 $ $ q_2 $ $ q_3 $ $ q_4 $ $ q_5 $ $ q_6 $

Output Format

Output the probability that tourist wins. The absolute or relative error must be no more than $ 10^{-9} $.

Sample Input and Output

Sample Input #1

25 25 25 25 0 0
0 0 0 0 50 50

Sample Output #1

1.000000000000

Sample Input #2

10 20 20 10 20 20
20 20 20 10 10 20

Sample Output #2

0.550000000000

Notes/Hints

Constraints

  • $0\ \leq\ p_i,\ q_i\ \leq\ 100$
  • $p_1\ +\ ...\ +\ p_6\ =\ q_1\ +\ ...\ +\ q_6\ =\ 100$
  • All input values are integers.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
25 25 25 25 0 0 0 0 0 0 50 50
样例输出
1.000000000000