当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1245:Programmer, Rank Thyself

题目描述
Implement a ranking program similar to the one used for this programming contest.
输入解释
The input file contains one or more contests followed by a line containing only zero that signals the end of the file. Each contest begins with a line containing a positive integer c no greater than 20 indicating the number of teams in the contest, and is followed by c lines that contain a team name and the solution times for seven problems, separated by spaces. Team names consist of between one and ten letters. All team names within a contest are unique. Times are nonnegative integers no greater than 500.

As described in the Notes to Teams, teams are ranked first by greatest number of problems solved, then by least total time, then by least geometric mean of all nonzero times. Teams that are still tied are given the same numeric ranking and are listed in alphabetical order, using case-sensitive string comparison. The numeric ranking for a team is always one more than the number of teams ranked ahead of (not tied with) that team. For this problem all geometric means will be rounded to an integer as described below, and only the rounded value will be used when computing rankings and displaying results.

If all times are zero, then the geometric mean is also zero. Otherwise, if there are n nonzero times t1, ..., tn, then the geometric mean is defined to be

exp ((ln t1 + ln t2 + ... + ln tn) / n)

where exp x means ex and ln x means the natural logarithm of x. (There are other mathematically equivalent definitions of the geometric mean, but they may produce slightly different answers due to roundoff and/or overflow problems. Use this definition to get the same answers as the judges.) After computing the geometric mean, round it to an integer by adding 0.5 and truncating any fractional digits. (C/C++ and Java automatically truncate fractions when casting a floating-point type to an integral type. In Pascal use the trunc function.)
输出解释
For each contest you must output the rankings in a table. All tables will have the same width, with the length equal to the number of teams entered in the contest. Use the exact format shown in the examples. Each contest has a numbered header followed by a table with one team entry per line. Each entry contains the ranking, team name, problems solved, total time, geometric mean, and then the individual solution times in the same order they appeared in the input. In the first example all values completely fill their fields. In general you may need to pad values with spaces (never tabs) so that they have the correct field width. The team name is left-justified, and all other fields are right-justified. The ranking always has two digits, including a leading zero if necessary. Spaces will never appear at the beginning or end of lines.
输入样例
1
Plutonians 123 234 345 456 167 278 389
4
Xap 0 0 0 0 0 0 0
Foo 20 30 0 50 40 0 10
Bar 0 50 20 0 10 40 30
Baz 0 0 0 0 0 0 0
3
Venus 213 0 0 57 0 0 0
Neptune 0 0 0 117 153 0 0
Mars 0 150 0 0 0 0 120
0
输出样例
CONTEST 1
01 Plutonians 7 1992 261 123 234 345 456 167 278 389
CONTEST 2
01 Bar        5  150  26   0  50  20   0  10  40  30
01 Foo        5  150  26  20  30   0  50  40   0  10
03 Baz        0    0   0   0   0   0   0   0   0   0
03 Xap        0    0   0   0   0   0   0   0   0   0
CONTEST 3
01 Venus      2  270 110 213   0   0  57   0   0   0
02 Mars       2  270 134   0 150   0   0   0   0 120
02 Neptune    2  270 134   0   0   0 117 153   0   0

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Mid-Central USA 2002

源链接: POJ-1245

最后修改于 2020-10-29T05:58:46+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000