- GIGA Universe Cup 计算概率几分
Following FIFA World Cup, a larger competition called "GIGA Universe Cup" is taking place somewhere in our universe. Both FIFA World Cup and GIGA Universe Cup are two rounds competitions that consist of the first round, also known as "group league", and the second called "final tournament." In the first round, participating teams are divided into groups of four teams each. Each team in a group plays a match against each of the other teams in the same group. For example, let's say we have a group of the following four teams, "Engband, Swedon, Argontina, and Nigerua." They play the following six matches: Engband - Swedon, Engband - Argontina, Engband - Nigerua, Swedon - Argontina, Swedon - Nigerua, and Argontina - Nigerua.
The result of a single match is shown by the number of goals scored by each team, like "Engband 1 - 0 Argontina," which says Engband scored one goal whereas Argontina zero. Based on the result of a match, points are given to the two teams as follows and used to rank teams. If a team wins a match (i.e., scores more goals than the other), three points are given to it and zero to the other. If a match draws (i.e., the two teams score the same number of goals), one point is given to each.
The goal difference of a team in given matches is the total number of goals it scored minus the total number of goals its opponents scored in these matches. For example, if we have three matches "Swedon 1 - 2 Engband," "Swedon 3 - 4 Nigerua," and "Swedon 5 - 6 Argontina," then the goal difference of Swedon in these three matches is (1 + 3 + 5) - (2 + 4 + 6) = -3.
Given the results of all the six matches in a group, teams are ranked by the following criteria, listed in the order of priority (that is, we first apply (a) to determine the ranking, with ties broken by (b), with ties broken by (c), and so on).
(a) greater number of points in all the group matches,
(b) greater goal difference in all the group matches,
(c) greater number of goals scored in all the group matches.
If two or more teams are equal on the basis of the above three criteria, their place shall be determined by the following criteria, applied in this order:
(d) greater number of points obtained in the group matches between the teams concerned,
(e) greater goal difference resulting from the group matches between the teams concerned,
(f) greater number of goals scored in the group matches between the teams concerned,
If two or more teams are still equal, apply (d), (e), and (f) as necessary to each such group. Repeat this until those three rules to equal teams do not make any further resolution. Finally, teams that still remain equal are ordered by :
(g) drawing lots by the Organizing Committee for the GIGA Universe Cup.
The two teams coming first and second in each group qualify for the second round.
Your job is to write a program which, given the results of matches played so far in a group and one team specified in the group, calculates the probability that the specified team will qualify for the second round.
You may assume each team has played exactly two matches and has one match to play. In total, four matches have been played and two matches are to be played.
Assume the probability that any team scores (exactly) p goals in any match is:
8!/(P!(8 - P)!)*(1/4)^p*(3/4)^(8-p) ,
for p <= 8, and zero for p > 8. Assume the lot in the step (g) is fair.
The first line of the input is an integer, less than 1000, that indicates the number of subsequent records.
The rest of the input is the indicated number of records. A single record has the following format:
(empty) (-) (team)1 (-) (team)2 (-) (team)3 (-) (team)4
(team)1 (-) (empty) (-) (m)12 (-) (m)13 (-) (m)14
(team)2 (-) (empty) (-) (empty) (-) (m)23 (-) (m)24
(team)3 (-) (empty) (-) (empty) (-) (empty) (-) (m)34
(team)4 (-) (empty) (-) (empty) (-) (empty) (-) (empty)
In the above, (-) is a single underscore (-) and (empty) a sequence of exactly four underscores (____). Each of (team)1,?,(team)4 is either an asterisk character (*) followed by exactly three uppercase letters (e.g., *ENG) , or an underscore followed by exactly three uppercase letters (e.g., SWE). The former indicates that it is the team you are asked to calculate the probability of the second round qualification for. You may assume exactly one of (team)1,?, (team)4 is marked with an asterisk. Each (m)ij (1 <= i < j <= 4) is a match result between the (team)i and (team)j. Each match result is either _-_ (i.e., two underscores, hyphen, and another underscore) or of the form _x-y where each of x and y is a single digit (<= 8). The former indicates that the corresponding match has not been played, whereas the latter that the result of the match was x goals by (team)i and y goals by (team)j. Since each team has played exactly two matches, exactly two match results are in the former format.
The output should consist of n lines where n is the number of records in the input. The ith line should show the probability that the designated team (marked with an asterisk) will qualify for the second round in the ith record.
Numbers should be printed with exactly seven digits after the decimal point. Each number should not contain an error greater than 10^(-7).
- 博客 Java基础知识面试题（2020最新版）
- 下载 基于西门子S7—1200的单部六层电梯设计程序，1部6层电梯
- 下载 捷联惯导仿真matlab
- 下载 图书管理系统（Java + Mysql）我的第一个完全自己做的实训项目
- 学院 玩转Linux：常用命令实例指南
- 学院 网络工程师小白入门--【思科CCNA、华为HCNA等网络工程师认证】
- 学院 C++语言基础视频教程
- 下载 微信小程序 实例汇总 完整项目源代码
- 学院 Python数据挖掘简易入门
- 下载 2020-五一数学建模大赛C类问题饲料加工配比及优化.pdf
- 学院 MySQL数据库从入门到实战应用
- 下载 navicat简体中文版 绿色版 （64位）
- 学院 机器学习初学者必会的案例精讲
- 博客 Python代码实现飞机大战
- 学院 一学即懂的计算机视觉（第一季）
- 下载 java jdk 8 帮助文档 中文 文档 chm 谷歌翻译
- 下载 Qt5.10 GUI完全参考手册(强烈推荐)
- 学院 Python可以这样学（第四季：数据分析与科学计算可视化）
- 学院 设计模式（JAVA语言实现）--20种设计模式附带源码
- 下载 进程监控软件 Performance Monitor中文版
- 下载 八数码的深度优先算法c++实现
- 下载 2021考研数学张宇基础30讲.pdf
- 学院 2019 Python开发者日-培训
- 下载 2020_五一数学建模_C题_整理后的数据.zip
- 学院 实用主义学Python（小白也容易上手的Python实用案例）