402790: GYM100883 A Random Fightings

Memory Limit:64 MB Time Limit:4 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Random Fightingstime limit per test4 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output

Nodar is a very famous gangster in Euroland, he has hundreds of friends but only N of them are gangsters like him, after his many successful heists in Linearland, Squareland and Cubeland, he decided to form a new gang called “The Nodar ACMers”.

He invited his N gangster friends and formed the gang very quickly, but all of his N friends are professional gangsters, and they’re very greedy.

Since gang leader will get 60% of the gang’s net income, all of them want that position.

Alex (Nodar's best friend) has 173 IQ points so he foresaw the bloodshed that will happen if each new leader is assassinated, so he devised a master plan to save his gang from all that terror thus having the freedom to terrorize the citizens of Euroland, and he said “Chess determines the skills of the true leader”, and then Nodar gave each of his friends a unique number from 1 to n, Nodar will host n - 1 matches, in each match the following will happen:

A pair of the remaining gangsters will be chosen at random ( the likelihood of choosing all pairs is uniform) The loser will be kicked out of the competition.

The remaining gangster will become the unquestioned boss of the gang, and will probably arrange Nodar’s “Accidental” death if he didn’t like him, Thus Nodar started to collect more information about his gang.

He found out that the probability of gangster i beating gangster j is Aij, it is guaranteed that Aij = 1 - Aji (Gangsters don’t believe in draws).

As Nodar’s personal programming assistant he asked you to write a program that would determine for each gangster, his probability of becoming the boss.

Input

The first line of the input contans one integer T , the number of testcases.

The first line of each testcase contains an integer N (1 ≤  N ≤  20) — the number of gang members.

Then there follows N lines with N real numbers each — matrix A.

Aij (0  ≤  Aij ≤  1) — the probability that gangster with index i beats gangster with index j. It's guaranteed that the main diagonal contains zeros only , and for other elements the following is true: Aij  =  1  -  Aji.

Output

For each test case print a single line containing "Case t:" (without the quotes) where t is the test case number (starting from 1) followed by a single space, followed by n space-separated real numbers with exactly 6 decimal places.

Number with index i should be equal to the probability that gangster with number i will win to be the leader of gang.

ExamplesInput
2
1
0.0
2
0.0 0.5
0.5 0.0
Output
Case 1: 1.000000 
Case 2: 0.500000 0.500000
Note

You should print exactly 6 decimal places (even if zeroes).

加入题单

算法标签: