挑战
您的目标是编写尽可能短的程序,该程序将获取事件列表(例如upvote,downvote等),并返回用户的声誉和所获得的特权。
什么样的事件?
这是事件的图表,按赢得信誉的顺序列出:
-15 answer unaccepted
-10 answer unupvoted
-5 question unupvoted
-2 answer downvoted
-2 question downvoted
-2 unaccept answer
-1 downvote answer
+1 join website
+1 undownvote answer
+2 accept answer
+2 question undownvoted
+2 answer undownvoted
+5 question upvoted
+10 answer upvoted
+15 answer accepted
+100 association bonus
什么样的特权?
这是特权列表,按要求的信誉顺序。
1 create posts
5 participate in meta
10 remove new user restrictions
10 create wiki posts
15 vote up
15 flag posts
20 talk in chat
50 comment everywhere
75 set bounties
100 edit community wiki
100 create chat rooms
125 vote down
150 create tags
200 retag questions
250 view close votes
500 cast close and reopen votes
750 established user
1000 edit questions and answers
1000 create gallery chat rooms
1250 create tag synonyms
1500 approve tag wiki edits
2000 access to moderator tools
3500 protect questions
4000 trusted user
输入值
输入(在STDIN上)将是事件的列表,每行一个,精确地显示它们在第一个图表中的显示方式(信誉值除外)。空行代表输入的结尾。这是一个示例(末尾应该有一个空白行):
join website
association bonus
answer upvoted
answer upvoted
question upvoted
answer accepted
answer upvoted
accept answer
unaccept answer
question unupvoted
accept answer
question upvoted
输出量
输出的第一行(到STDOUT)应命名累积的rep数量。此后的每一行都应列出所获得的一种特权,与显示的完全相同,并与第二张图表的顺序相同。上述输入的预期输出:
153 reputation
1 create posts
5 participate in meta
10 remove new user restrictions
10 create wiki posts
15 vote up
15 flag posts
20 talk in chat
50 comment everywhere
75 set bounties
100 edit community wiki
100 create chat rooms
125 vote down
150 create tags
规则,限制和注释
这是代码高尔夫。适用标准代码高尔夫规则。
(编辑:由于我有两个访问文件的条目,我想指出,文件长度需要作为代码高尔夫标准规则的一部分添加到代码长度中)