luogu#P10557. [ICPC2024 Xi'an I] Dumb Robot
[ICPC2024 Xi'an I] Dumb Robot
题目描述
You have a dumb robot, and you are going to let it play games with robots.
There is a matrix with three rows and three columns in the game. We call the number of row and column of this matrix . The game goes like this:
Two players each choose an integer from at the same time. We call the number your robot chooses , and the number the other robot chooses . The score is . In game , your robot will play this game with the -th robot. The -th robot has a probability of choosing as , a probability of choosing as , and a probability of choosing as .
Your goal is to make the expected value of the score not negative in each game. But your robot is very dumb, so it will choose with probability , with probability , and with probability , and you don't know the value of .
We all know that . If are chosen uniformly at random from a set of all possible cases, please calculate the probability that you will reach your goal.
输入格式
The first line contains one integer ().
Each of the next lines contains integers, the -th integer in the -th of these lines is ().
Each of the next lines contains real numbers, the -th number in the -th of these lines is . It is guaranteed that and .
输出格式
Output the answer to the problem. It is guaranteed that the answer will never be .
Your answer is considered correct if its absolute or relative error does not exceed . Formally, let your answer be , and the jury's answer be . Your answer is accepted if and only if .
1
1 1 1
-1 2 1
0 -3 2
0.1 0.6 0.3
0.748252
8
1 3 -2
0 0 2
-2 2 1
0.1 0.3 0.6
0 0 1
0.5 0.2 0.3
0 0 1
1 0 0
0 0 1
0.33 0.33 0.34
0.16 0.16 0.68
0.111111
提示
In example , for example, is ok. In this case, Your robot will always choose , so no matter what number will robot choose, the score will always be , which is enough to reach your goal.