Algorithm title: 542

Source: Internet
Author: User

France ' 98

Today's the round of the soccer world championship in France are coming to a end. Countries are remaining now, among which the winner was determined by the following tournament:

1 Brazil-----+

+-- ? --+

2 Chile------+ |

+-- ? --+

3 Nigeria----+ | |

+-- ? --+       |

4 Denmark----+ |

+-- ? --+

5 Holland----+ | |

+-- ?       --+       | |

6 Yugoslavia-+ |       | |

+-- ? --+       |

7 Argentina--+ | |

+-- ? --+               |

8 England----+ |

+--World Champion

9 Italy------+ |

+-- ? --+               |

Ten Norway-----+ | |

+-- ? --+       |

One france-----+ |       | |

+-- ?       --+       | |

Paraguay---+ | |

+-- ? --+

Germany----+ |

+-- ? - -+       |

Mexico-----+ | |

+-- ? - -+

Romania----+ |

+-- ? --+

Croatia----+

For each possible match a vs. B between this nations, you are given the probability this team A wins against B. This (together with the tournament mode displayed above) are sufficient to compute the probability that a given nation wins The world Cup. For example, if Germany wins against Mexico with 80%, Romania against Croatia with 60%, Germany against Romania with 70% a nd Germany against Croatia with 90%, then the probability this Germany reaches the semi-finals is 80% * (70% * 60% + 90% * 40%) = 62.4%.

Your task is to write a, computes the chances of the nations to become the world Champion ' 98.

Input

The input file would contain just one test case.

The lines of the input file give the names of the countries, from top to bottom according to the picture given Above.

Next, there'll follow a $times $ integer matrix P where element Pij gives the probability in percent that country # I defeats country #j in a direct match. Country #i means the i-th Country from top to bottom given in the list of countries. In the picture above Brazil are #1 and Germany are #13, so p1,13 = would mean, in a match between Brazil and Germany, Brazil wins with a probability of 55%.

Note This matches may isn't end with a draw, i.e Pij + Pji = to all i,j.

Output

Output lines of the form ' xxxxxxxxxx p=y.yy% ' where xxxxxxxxxx is the country ' s name, left-justified in a field of 1 0 characters, and Y.yy are their chance in percent to win the Cup, written to two decimal places. Use the "same order of countries" as the input file.

Sample Input

Brazil

Chile

Nigeria

Denmark

Holland

Yugoslavia

Argentina

England

Ital y

Norway

France

Paraguay

Germany

Mexico

Romania

Croatia

50 65 50 60 55 50 50 65 45 55 40 55 40 55-50 50

35 50 35 45 40 35 35 50 30 40 25 40 25 40-35 35

50 65 50 60 55 50 50 65 45 55 40 55 40 55-50 50

40 55 40 50 45 40 40 55 35 45 30 45 30 45-40 40

45 60 45 55 50 45 45 60 40 50 35 50 35 50-45 45

50 65 50 60 55 50 50 65 45 55 40 55 40 55-50 50

50 65 50 60 55 50 50 65 45 55 40 55 40 55-50 50

35 50 35 45 40 35 35 50 30 40 25 40 25 40-35 35

55 70 55 65 60 55 55 70 50 60 45 60 45 60-55 55

45 60 45 55 50 45 45 60 40 50 35 50 35 50-45 45

60 75 60 70 65 60 60 75 55 65 50 65 50 65-60 60

45 60 45 55 50 45 45 60 40 50 35 50 35 50-45 45

60 75 60 70 65 60 60 75 55 65 50 65 50 65-60 60

45 60 45 55 50 45 45 60 40 50 35 50 35 50-45 45

50 65 50 60 55 50 50 65 45 55 40 55 40 55-50 50

50 65 50 60 55 50 50 65 45 55 40 55 40 55-50 50

Sample Output

Brazil p=8.54%

Chile p=1.60%

Nigeria p=8.06%

Denmark p=2.79%

Holland p=4.51%

Yugoslavia p=7.50%

Argentina p=8.38%

England p=1.56%

Italy p=9.05%

Norway p=3.23%

France p=13.72%

Paraguay p=3.09%

Germany p=13.79%

Mexico p=3.11%

Romania p=5.53%

Croatia p=5.53%

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.