我们需要做篮球队的分类。
供参考,程序如下:
D.1 Procedure
Teams shall be classified according to their win-loss records, namely two (2) points
for each game won, one (1) point for each game lost (including lost by default) and
zero (0) points for a game lost by forfeit.
D.1.1 If there are two (2) teams in the classification with equal points, the result(s) of the
game(s) between the two (2) teams involved will be used to determine the placing.
D.1.2 If the points and the goal average in the games between the two (2) teams are still
the same, the classification will be determined by the goal average of all the games
played in the group by each team.
D.1.3 If there are more than two (2) teams in the classification with equal points, a second
classification will be established, taking into account only the results of the games
between the involved teams.
D.1.4 If at any stage of this procedure the number of teams with equal points is reduced
to only two (2) teams, the procedure in D.1.1 and D.1.2 above will be applied.
D.1.5 If in the second classification there are still teams with equal points, the goal
average will be used to determine the placing, taking into account only the results
of the games between the involved teams.
D.1.6 If there are still more than two (2) teams with the same goal average, the placing
will be determined using the goal average from the results of all their games played
in the group.
D.1.7 If at any stage of this procedure the number of teams with equal points is reduced
to a tie still involving more than two (2) teams, the procedure, beginning with D.1.3
above, is repeated.
D.1.8 Goal average will always be calculated by division.
问题是如何处理D.1.3部分,其中说:If there are more than two (2) teams in the classification with equal points, a second
classification will be established, taking into account only the results of the games
between the involved teams.
如何对第二个分类建模以及如何根据它们之间的游戏结果做出决定?
答案 0 :(得分:1)
对于拥有相同分数的k队,建造一个较小的“联赛表”,大小为k,其中只会根据这些球队之间的比赛填充分数和目标。
在这个较小的表上递归激活排名过程。
如果在2次递归呼叫[团队完全平等]之间没有团队减少或者确定完整排名时停止。如果列表由两个只有相同点的团队组成:适用次要标准。
答案 1 :(得分:1)
您的比较者可以参考团队列表。然后,即使在调用过程D.1.3的情况下,它也能够比较这两个元素。
答案 2 :(得分:1)
这样做是如何在现实生活中做到的:
答案 3 :(得分:-1)
您可以使用BogoSort。
List<Team>
是否正确排序。然后您的代码将如下所示。
void sort(列出团队) { while(!validator。有效(团队)) { 收藏。洗牌(队); } }