|
||||||||||
ballsTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 361 Accepted Submission(s): 239 Problem Description There are $n$ balls with $m$ colors. The possibility of that the color of the $i$-th ball is color $j$ is $\frac{a_{i,j}}{a_{i,1}+a_{i,2}+...+a_{i,m}}$. If the number of balls with the $j$-th is $x$, then you should pay $x^2$ as the cost. Please calculate the expectation of the cost. Input Several test cases(about $5$) For each cases, first come 2 integers, $n,m(1 \leq n \leq 1000,1 \leq m \leq 1000)$ Then follows $n$ lines with $m$ numbers $a_{i,j} ( 1 \leq a_i \leq 100)$ Output For each cases, please output the answer with two decimal places. Sample Input
Sample Output
Source | ||||||||||
|