| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1961 人关注过本帖
标题:[求助]ACM10194: Football (aka Soccer)
只看楼主 加入收藏
yelo20053533
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2006-11-27
收藏
 问题点数:0 回复次数:25 
[求助]ACM10194: Football (aka Soccer)

The Problem

Football the most popular sport in the world (americans insist to call it "Soccer", but we will call it "Football"). As everyone knows, Brasil is the country that have most World Cup titles (five of them: 1958, 1962, 1970, 1994 and 2002). As our national tournament have many teams (and even regional tournaments have many teams also) it's a very hard task to keep track of standings with so many teams and games played!

So, your task is quite simple: write a program that receives the tournament name, team names and games played and outputs the tournament standings so far.

A team wins a game if it scores more goals than its oponent. Obviously, a team loses a game if it scores less goals. When both teams score the same number of goals, we call it a tie. A team earns 3 points for each win, 1 point for each tie and 0 point for each loss.

Teams are ranked according to these rules (in this order):

  1. Most points earned.
  2. Most wins.
  3. Most goal difference (i.e. goals scored - goals against)
  4. Most goals scored.
  5. Less games played.
  6. Lexicographic order.

The Input

The first line of input will be an integer N in a line alone (0 < N < 1000). Then, will follow N tournament descriptions. Each one begins with the tournament name, on a single line. Tournament names can have any letter, digits, spaces etc. Tournament names will have length of at most 100. Then, in the next line, there will be a number T (1 < T <= 30), which stands for the number of teams participating on this tournament. Then will follow T lines, each one containing one team name. Team names may have any character that have ASCII code greater than or equal to 32 (space), except for '#' and '@' characters, which will never appear in team names. No team name will have more than 30 characters.

Following to team names, there will be a non-negative integer G on a single line which stands for the number of games already played on this tournament. G will be no greater than 1000. Then, G lines will follow with the results of games played. They will follow this format:

team_name_1#goals1@goals2#team_name_2

For instance, the following line:

Team A#3@1#Team B

Means that in a game between Team A and Team B, Team A scored 3 goals and Team B scored 1. All goals will be non-negative integers less than 20. You may assume that there will not be inexistent team names (i.e. all team names that appear on game results will have apperead on the team names section) and that no team will play against itself.

The Output

For each tournament, you must output the tournament name in a single line. In the next T lines you must output the standings, according to the rules above. Notice that should the tie-breaker be the lexicographic order, it must be done case insenstive. The output format for each line is shown bellow:

[a]) Team_name [b]p, [c]g ([d]-[e]-[f]), [g]gd ([h]-[i])

Where:

  • [a] = team rank
  • [b] = total points earned
  • [c] = games played
  • [d] = wins
  • [e] = ties
  • [f] = losses
  • [g] = goal difference
  • [h] = goals scored
  • [i] = goals against

There must be a single blank space between fields and a single blank line between output sets. See the sample output for examples.

Sample Input

2
World Cup 1998 - Group A
4
Brazil
Norway
Morocco
Scotland
6
Brazil#2@1#Scotland
Norway#2@2#Morocco
Scotland#1@1#Norway
Brazil#3@0#Morocco
Morocco#3@0#Scotland
Brazil#1@2#Norway
Some strange tournament
5
Team A
Team B
Team C
Team D
Team E
5
Team A#1@1#Team B
Team A#2@2#Team C
Team A#0@0#Team D
Team E#2@1#Team C
Team E#1@2#Team D

Sample Output

World Cup 1998 - Group A
1) Brazil 6p, 3g (2-0-1), 3gd (6-3)
2) Norway 5p, 3g (1-2-0), 1gd (5-4)
3) Morocco 4p, 3g (1-1-1), 0gd (5-5)
4) Scotland 1p, 3g (0-1-2), -4gd (2-6)

Some strange tournament
1) Team D 4p, 2g (1-1-0), 1gd (2-1)
2) Team E 3p, 2g (1-0-1), 0gd (3-3)
3) Team A 3p, 3g (0-3-0), 0gd (3-3)
4) Team B 1p, 1g (0-1-0), 0gd (1-1)
5) Team C 1p, 2g (0-1-1), -1gd (3-4)
搜索更多相关主题的帖子: Football Soccer aka 
2006-12-05 19:38
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
收藏
得分:0 
最好提供中文翻译后的原题

My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2006-12-05 20:22
yelo20053533
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2006-11-27
收藏
得分:0 
原题就是英文,ACM的原题都是英文
2006-12-05 20:24
yelo20053533
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2006-11-27
收藏
得分:0 

足球

问题:
足球是世界上最流行的运动(美国人坚持叫他英式足球,但我们叫它足球)。就像每个人知道的那样,巴西是世界上获得世界杯冠军最多的国家(1958, 1962, 1970, 1994 和 2002)。我们的国家联赛有很多队伍(并且甚至很多地区联赛也有很多队伍),因此在这么多已经进行的比赛和队伍中找到排名是一个很艰巨的任务!·

所以,你的任务很简单:写一个这样的程序,它能接受联赛名字,队伍名和已经完成的比赛,并且输出到目前为止联赛的排名。

一个队伍比他的对手的进球数多示为赢得一场比赛。明显的,一个队伍如果进的球少,则输掉了。如果进球数相同,我们叫它平局。一个球队赢一场得3分,平一场得1分,输一场得0分。

比赛根据以下规则被排队:(都满足上一个则按下一个规则排)
1。最多的分数
2。最多的胜场
3。最多的净胜球(进-被进)
4。最多的进球数
5。进行了最少的比赛
6。按字典顺序


输入
第一行输入是一个数字N(单独的一行(0 < N < 1000)).然后,跟着N场比赛的描述.首先是联赛名字,在单独一行.联赛名能有任何字母,数字和符号等等.联赛名字最长100.然后,在下一行开始有一单独一行输入一个数字T(1 < T <=30),代表有多少队伍参加.然后跟着有T行,每行包括一个队伍名字.队伍名字可能含有任何大于或者等于32(空格)的ASCII码,但是"#"和"@"这些是不应出现的在队伍名字里的.任何队伍最长30个字符.

跟着队伍名的是非负整数 G 在单独一行,G代表联赛里已经进行了的比赛.G<=1000小.然后G行跟在后面,它们根据以下格式:

team_name_1#goals1@goals2#team_name_2

比如:
Team A#3@1#Team B
意味着这是一场在A队和B队之间进行的比赛,A队进3球,B队1球.所有球是小于20的非负整数.你可以假设没有不存在的队伍名(也就是,所有出现在了比赛结果里的队伍名字都在队伍名字部分出现过了)而且没有队伍会和他自己进行一场比赛.

比如:
Team A#3@1#Team B
意味着这是一场在A队和B队之间进行的比赛,A队进3球,B队1球.所有球是小于20的非负整数.你可以假设没有不存在的队伍名(也就是,所有出现在了比赛结果里的队伍名字都在队伍名字部分出现过了)而且没有队伍会和他自己进行一场比赛.


输出:
对于每一个联赛,你必须输出联赛名字在单独的一行.在下面T行里你必须输出排名,根据上面讲到的规则.注意:加时赛必须按字典顺序,如果有它存在的话.输出格式像下面这样:

[a]) Team_name [b]p, [c]g ([d]-[e]-[f]), [g]gd ([h]-[i])

Where:

[a] = 排名
[b] = 所得分数
[c] = 已经参加的场数
[d] = 赢的场次数
[e] = 平局数
[f] = 输的场次数
[g] = 净胜球
[h] = 进球数
[i] = 被进球数

这里要有单独的一个空格在每部分之间.
看看例子就明白了

2006-12-05 20:29
yelo20053533
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2006-11-27
收藏
得分:0 
人工翻译
2006-12-05 21:31
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
收藏
得分:0 

...好麻烦的题

算法思想:
定义结构体:
struct {
char name[31]; /*队名*/
int a; /*分数*/
int b; /*胜场*/
int c; /*净胜球*/
int d; /*进球数*/
int e; /*比赛次数*/
} s[1000];

然后按格式读入数据,在读入的同时进行分数累计,胜场数累计,净胜球与进球数及

比赛次数的累计;

最后工作是进行结果搜索,按照a->b->c->d->e->name先后的次序进行排序(可以利

用stdlib.h中的qsort)

然后按格式输出


My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2006-12-06 12:45
yelo20053533
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2006-11-27
收藏
得分:0 
这怎么写啊??
2006-12-06 18:09
yelo20053533
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2006-11-27
收藏
得分:0 

用C如何实现??

2006-12-06 19:16
yelo20053533
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2006-11-27
收藏
得分:0 
还是不懂
2006-12-07 12:01
yelo20053533
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2006-11-27
收藏
得分:0 
中文翻译可能不准,仅供参考
2006-12-07 21:12
快速回复:[求助]ACM10194: Football (aka Soccer)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026184 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved