编程介的小学生 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
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示