KPB - Point Blank
#include <pointblank>
In a town called "Fernando Pessoa", during the year of 2050, there was a game named PointBlank that has became very popular in the city. It was a classic online FPS game, where people of each team had to kill the players of the other team. The winner of a game was the one that killed the most amount of players after the end of all rounds.
The game was divided in M rounds, each one with N players in different positions. Kurohitsugi, the best player in the town was challenged to kill all the other N players in each round. He knows that he has only one chance: if he dies once, he loses.
According to a very experient captain, Sr. Anonymate, the best position where a player can stay in is exactly a point x that minimizes the sum of the squares of the distances to the other players. And, magically, we know that the probability of killing an oponent is exactly this point 'x' divided by 100.
He wants to calculate the probability sum of killing all the soldiers in all the M rounds if he stays in the point x, but he isn't good in math or programming, so he asked for your help.
Input
The first line will contain two integers, N and M (1 <= N <= 20, 1 <= M <= 10^6): the amount of players and the amount of rounds. Each of the next M lines will contain N integers Xi (1 <= Xi <= 100): the positions of the players.
Output
You have to print the sum of the probabilities of killing all the N players in each round.
Example
Input: 1 2 50 50 Output: 1.00000 |
Input: 1 1 100 Output: 1.00000 |
Input: 4 2 5 9 98 100 16 17 25 29 Output: 0.081143 |
hide comments
:D:
2012-09-10 09:48:40
Also, because of popular demand, I'm moving it to tutorial. |
|
:D:
2012-09-10 09:47:38
You have the point x for every line separately. Also remember that the optimal point x may not have integer coordinate. What is easy to miss here and should be underlined in the description, is that probability x/100 is for killing exactly one enemy. You want to kill all N, so you have do something more with that value. |
|
Mateus Dantas [ UFCG ]:
2012-08-28 17:50:24
Well, as he said, explain the 3rd case is the solution of this problem! Last edit: 2012-08-28 17:50:39 |
|
game2712:
2012-08-28 17:03:13
plz explain 3rd case
|
|
Francky:
2012-08-28 16:08:43
Explain the third case is equivalent to give the solution of this tutorial problem. So it's impossible, sorry. |
|
mehmetin:
2012-08-27 14:09:10
Can someone explain the third case, pls? |
|
saket diwakar:
2012-08-27 10:28:36
tutorial one..... |
|
Mateus Dantas [ UFCG ]:
2012-08-25 17:06:12
Enjoy it!
|
Added by: | Mateus Dantas [ UFCG ] |
Date: | 2012-08-25 |
Time limit: | 0.105s-0.709s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Mateus Dantas |