#P1921. 赌博游戏【数据有误】
赌博游戏【数据有误】
Description
A cheating casino has dice. In this casino, there may have been games. Each game consists of rolling a die to produce a face value. We do not know which die was used, but we do know the outcome of the -th game.
For die , the probability of rolling face is . After using die , the probability that the next game uses die is . In particular, for the first game, the probability of using die is .
Curious Xiao v asks you to compute the probability that these games occurred in this casino.
Input Format
The first line contains three positive integers .
The second line contains floating-point numbers, representing .
Lines 3 to contain floating-point numbers; in row and column is .
Lines to contain floating-point numbers; in row and column is .
Line contains positive integers, representing the game outcomes , i.e., the face values rolled in each game.
Output Format
Output the required probability, rounded to four decimal places.
3 10 3
1 0 0
0.03 0.03 0.94
0.02 0.02 0.96
0.99 0.005 0.005
0.01 0.99 0
0.05 0.05 0.90
0.98 0.002 0.008
2 2 0 2 2 0 2 2 0 2
0.4483
Hint
Constraints and notes:
- For 30% of the testdata: , , .
- For 100% of the testdata: , , .
The matrices and the vector satisfy the characteristic conditions of probability transitions.
Translated by ChatGPT 5
京公网安备 11011102002149号