编程介的小学生 2017-09-02 12:27 采纳率: 20.5%
浏览 623
已采纳

Football Match

Today football has become the most popular sport all over the world. Many countries have their own football league matches. And the FIFA wants to hold a great league match which could contains all the clubs throughout the world. It is difficult to rank so many teams just by hand. So they come to you for help.

The rules of ranking are:
1. A team will get 3 points when they win a match, 1 point when get a draw, 0 point when lost.
2. Teams are ranked by their total points first. If two teams have the same points, the team who get the more "goal difference" ranks higher. "Goal difference" for a team is equal to the total number of balls they goal minus those they lost.
3. If two teams have both the same points and the same "goal difference", ranking them by their name alphabetically.

Input

The input contains many cases. The beginning of each case is a num m (m<=10000), which is the number of matches. The following m lines each give a score of a match. The format is:
Team_name1 score1:score2 Team_name2
The length of team name is no more than 20 characters and the scores are less than 100. You may assume that every team in the league has taken part in at least one match.

Output

For each case output a ranking table, each team a line. The format of each line is
Id Nm w d l Pt Gd
"Id" is the index of the team starting from 1. "Nm" is the name of the team. "w", "d" and "l" respectively is the total number of matches the team win, draw and lost. "Pt" is the points of the team. And "Gd" is the team's goal difference.
Use a single blank to separate all cases.

Sample Input
4
Liverpool 1:0 ManchesterU
ManchesterU 3:0 Leeds
Arsenal 2:2 Liverpool
Leeds 1:5 Arsenal
6
RealMadrid 3:2 ACMilan
ZJGreenCity 3:2 RealMadrid
ACMilan 1:4 ZJGreenCity
RealMadrid 0:0 ZJGreenCity
ACMilan 2:0 RealMadrid
ZJGreenCity 3:3 ACMilan
Sample Output
1 Arsenal 1 1 0 4 4
2 Liverpool 1 1 0 4 1
3 ManchesterU 1 0 1 3 2
4 Leeds 0 0 2 0 -7

1 ZJGreenCity 2 2 0 8 4
2 ACMilan 1 1 2 4 -2
3 RealMadrid 1 1 2 4 -2

  • 写回答

1条回答 默认 最新

  • 战在春秋 2017-09-04 21:32
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能