C - Biased Dice Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 8

問題文

3 個の 6 面サイコロがあり、i 番目のサイコロを振った時に出目 j が出る確率は \frac{P_{i,j}} {100} です。

3 個のサイコロを振った時出目の和が K になる確率を K=1,2,\ldots,18 について求めてください。

制約

  • 0\leq P_{i,j}\leq 100
  • P_{i,1}+P_{i,2}+P_{i,3}+P_{i,4}+P_{i,5}+P_{i,6} = 100
  • 入力は全て整数

入力

入力は以下の形式で標準入力から与えられる。

P_{1,1} P_{1,2} P_{1,3} P_{1,4} P_{1,5} P_{1,6}
P_{2,1} P_{2,2} P_{2,3} P_{2,4} P_{2,5} P_{2,6}
P_{3,1} P_{3,2} P_{3,3} P_{3,4} P_{3,5} P_{3,6}

出力

3 個のサイコロを振った時出目の和が K になる確率を R_K とする。

18 行に渡って答えを出力せよ。 i\ (1 \leq i \leq 18) 行目には R_{i} を出力せよ。

なお、想定解答との絶対誤差または相対誤差が 10^{-4} 以下であれば正解として扱われる。


入力例 1

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

出力例 1

0.000000
0.000000
0.001000
0.003000
0.009000
0.019000
0.036000
0.060000
0.086000
0.114000
0.132000
0.140000
0.132000
0.108000
0.080000
0.048000
0.024000
0.008000

入力例 2

100 0 0 0 0 0
100 0 0 0 0 0
100 0 0 0 0 0

出力例 2

0.000000
0.000000
1.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000

Score : 8 points

Problem Statement

We have three six-sided dice. When the i-th die is thrown, it shows the number j with the probability \frac{P_{i,j}} {100}.

If we throw these three dice, what is the probability that the sum of the numbers shown is K, for each K=1,2,\ldots,18?

Constraints

  • 0\leq P_{i,j}\leq 100
  • P_{i,1}+P_{i,2}+P_{i,3}+P_{i,4}+P_{i,5}+P_{i,6} = 100
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

P_{1,1} P_{1,2} P_{1,3} P_{1,4} P_{1,5} P_{1,6}
P_{2,1} P_{2,2} P_{2,3} P_{2,4} P_{2,5} P_{2,6}
P_{3,1} P_{3,2} P_{3,3} P_{3,4} P_{3,5} P_{3,6}

Output

Let R_K be the probability that the sum of the numbers shown is K when throwing the three dice.

Print 18 lines, the i-th of which (1 \leq i \leq 18) contains R_{i}.

Your output will be considered correct if its absolute or relative errors from the judge's answer are at most 10^{-4}.


Sample Input 1

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

Sample Output 1

0.000000
0.000000
0.001000
0.003000
0.009000
0.019000
0.036000
0.060000
0.086000
0.114000
0.132000
0.140000
0.132000
0.108000
0.080000
0.048000
0.024000
0.008000

Sample Input 2

100 0 0 0 0 0
100 0 0 0 0 0
100 0 0 0 0 0

Sample Output 2

0.000000
0.000000
1.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000