介绍
当有人将您喜欢的相册上传到YouTube时,您是否不讨厌它,但是说明中仅包含曲目列表?像这样:
1. Everything in Its Right Place - 4:11
2. Kid A - 4:44
3. The National Anthem - 5:50
4. How to Disappear Completely - 5:55
5. Treefingers - 3:42
6. Optimistic - 5:16
7. In Limbo - 3:31
8. Idioteque - 5:09
9. Morning Bell - 4:29
10. Motion Picture Soundtrack - 6:59
现在您不知道早晨的钟声何时开始,除非您花费大量时间在脑海中!通常,一些善良的人会过去,并在(可怕的)评论部分中留下一个方便的时间表,该时间表如下所示:
(0:00:00) Everything in Its Right Place
(0:04:11) Kid A
(0:08:55) The National Anthem
(0:14:45) How to Disappear Completely
(0:20:40) Treefingers
(0:24:22) Optimistic
(0:29:38) In Limbo
(0:33:09) Idioteque
(0:38:18) Morning Bell
(0:42:47) Motion Picture Soundtrack
规格
您的任务是编写一个程序或函数,该程序或函数将曲目列表作为输入,并将时间表作为输出。
- 您可以选择从STDIN读取输入,或者从参数字符串或行的参数列表中读取。同样,您可以选择将输出打印到STDOUT,或者返回一个字符串,或者返回一个行列表。如果没有这些,请尽一切可能对您的语言有意义。
您可以假设每个输入行都具有format
(\d+)\. [A-Za-z0-9 ]{1,100} - (\d+):(\d\d)
。对于正则表达式受损的用户,这实际上意味着您可以假设每一行的格式正确(如上),并且歌曲标题仅由字母数字ASCII字符和空格组成,并且长度不超过100个字节。- 曲目的长度始终至少为
0:01
,且不超过59:59
。 - 曲目编号从递增,
1
直到不超过99
。 - 专辑的总长度不超过
9:59:59
。
这是代码高尔夫球,因此最短的代码(以字节为单位)获胜。
测试用例
您的程序应正确执行介绍中介绍的转换(Radiohead的Kid A)。这是一个更大的测试用例(Sufjan Stevens的Illinois 1),带有长字符串,您的程序也应适用于此:
1. Concerning the UFO Sighting Near Highland Illinois - 2:08
2. The Black Hawk War - 2:14
3. Come On Feel the Illinoise - 6:45
4. John Wayne Gacy Jr - 3:19
5. Jacksonville - 5:24
6. A Short Reprise for Mary Todd Who Went Insane but for Very Good Reasons - 0:47
7. Decatur or Round of Applause for Your Stepmother - 3:03
8. One Last Whoo Hoo for the Pullman - 0:06
9. Chicago - 6:04
10. Casimir Pulaski Day - 5:53
11. To the Workers of the Rock River Valley Region - 1:40
12. The Man of Metropolis Steals Our Hearts - 6:17
13. Prairie Fire That Wanders About - 2:11
14. A Conjunction of Drones Simulating the Way - 0:19
15. The Predatory Wasp of the Palisades Is Out to Get Us - 5:23
16. They Are Night Zombies They Are Neighbors They Have Come Back from the Dead Ahhhh - 5:09
17. Lets Hear That String Part Again Because I Dont Think They Heard It All the Way Out in Bushnell - 0:40
18. In This Temple as in the Hearts of Man for Whom He Saved the Earth - 0:35
19. The Seers Tower - 3:53
20. The Tallest Man the Broadest Shoulders - 7:02
21. Riffs and Variations on a Single Note - 0:46
22. Out of Egypt into the Great Laugh of Mankind and I Shake the Dirt from My Sandals as I Run - 4:21
正确的输出是:
(0:00:00) Concerning the UFO Sighting Near Highland Illinois
(0:02:08) The Black Hawk War
(0:04:22) Come On Feel the Illinoise
(0:11:07) John Wayne Gacy Jr
(0:14:26) Jacksonville
(0:19:50) A Short Reprise for Mary Todd Who Went Insane but for Very Good Reasons
(0:20:37) Decatur or Round of Applause for Your Stepmother
(0:23:40) One Last Whoo Hoo for the Pullman
(0:23:46) Chicago
(0:29:50) Casimir Pulaski Day
(0:35:43) To the Workers of the Rock River Valley Region
(0:37:23) The Man of Metropolis Steals Our Hearts
(0:43:40) Prairie Fire That Wanders About
(0:45:51) A Conjunction of Drones Simulating the Way
(0:46:10) The Predatory Wasp of the Palisades Is Out to Get Us
(0:51:33) They Are Night Zombies They Are Neighbors They Have Come Back from the Dead Ahhhh
(0:56:42) Lets Hear That String Part Again Because I Dont Think They Heard It All the Way Out in Bushnell
(0:57:22) In This Temple as in the Hearts of Man for Whom He Saved the Earth
(0:57:57) The Seers Tower
(1:01:50) The Tallest Man the Broadest Shoulders
(1:08:52) Riffs and Variations on a Single Note
(1:09:38) Out of Egypt into the Great Laugh of Mankind and I Shake the Dirt from My Sandals as I Run
排行榜
为了使您的分数出现在黑板上,应该采用以下格式:
# Language, Bytes
1.向Sufjan表示歉意,我不得不对其惊人的音轨名称进行一些修改,以使其适合于此问题仅限于的简单格式。
输出中是否可以包含尾随空格?
—
马丁·恩德
Radiohead和Sufjan Stevens?Meh :-P
—
Luis Mendo
不; 每行的格式为
—
林恩
(h:mm:ss) Track Name
,紧随其后的是换行符。
@LuisMendo可以在您的答案中随意展示您卓越的音乐品味...?
—
林恩
哈哈哈 这是一个很好的回答动机。顺便说一句,我喜欢这个挑战,并且我已经接受了挑战
—
Luis