F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

balls

Time 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
2 2 1 1 3 5 2 2 4 5 4 2 2 2 2 4 1 4
 

Sample Output
3.00 2.96 3.20
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 12:38:23, Gzip enabled