Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1520860
  • 博文数量: 289
  • 博客积分: 11086
  • 博客等级: 上将
  • 技术积分: 3291
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-22 17:06
个人简介

徐小玉的博客。

文章分类

全部博文(289)

文章存档

2023年(6)

2022年(1)

2021年(2)

2020年(9)

2019年(9)

2018年(6)

2017年(10)

2016年(10)

2014年(3)

2013年(4)

2011年(12)

2010年(16)

2009年(14)

2008年(119)

2007年(48)

2006年(20)

我的朋友

分类:

2008-03-21 16:36:31

Advanced Event 2: Skating on Thin Ice

Important: The deadline for this event has passed. Solutions are available in , , and .

In Skating on Thin Ice competitors must write a script that determines the winner of a figure skating competition.

Not a native speaker of English? These event instructions are also available in the following languages: Chinese (Simplified); Chinese (Traditional); French; German; Japanese; Portuguese Brazilian; Russian; and Spanish. For more information, and to access these localized instructions, see the Scripting Games .

*
On This Page
About This Event
Event Scenario

About This Event

Division

Advanced

Deadline

Wednesday, February 20, 2008 (8:00 AM PST

Points Awarded

10

Top of page

Event Scenario

If you’re likely the Scripting Guys, your fondest wish in life is to be able to judge a figure skating contest. Event 2 in the Advanced Division is proof that wishes really do come true.

OK, if you want to get picky, you don’t actually get to judge a figure skating contest; the judging has already been done for you. Instead, all you have to do is determine who actually won the contest, using a formula roughly similar to that used by the International Skating Union. Sounds fun, huh?

To determine the winner your script must use the scoring information found in the text file Skaters.txt (which can be found in the ). Each line in the text file consists of information for an entrant in the competition; more specifically, each line contains the skater’s name followed by the scores awarded by each of the seven judges:

Ken Myer,55,66,76,67,59,70,54

To calculate Ken Myer’s score you (or, more precisely, your script) must do the following:

Throw out the highest of his seven scores (76).

Throw out the lowest of his seven scores (54).

Average the remaining five scores (55, 66, 67, 59, and 70).

Thus Ken Myer would receive a score of 63.4 (55 + 66 + 67 + 59 +70, all divided by 5).

To receive credit for this event your script must report back the winners of the gold (skater with the highest score); silver (skater with the second-highest score); and bronze (skater with the third-highest score) medals, along with their score. Your final output should look similar to this:

Gold medal: Ken Myer, 63.4
Silver medal: Pilar Ackerman, 62.78
Bronze medal: Jonathan Haas, 61.8272

If another of your fondest wishes is to successfully complete this event, make sure you place the file Skaters.txt in the folder C:\Scripts; if you use any folder other than C:\Scripts then your script is likely to fail. Also, you must display the results in the command window; do not overwrite the file Skaters.txt. If you do overwrite the file, you will not receive any points for the event. (And we won’t be very happy with you, because you’ll have overwritten our copy of the file!)

Note that your script does not have to include code for handling ties. We’ve set up the scores to make sure that there won’t be any ties for the top 3 positions.

阅读(1086) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~