人与龙和谐相处的博克岛上正在举办喜羊羊版的魁地奇(魁地奇是《哈利·波特》系列中重要的空中团队对抗运动 Quidditch的中文译名,是魔法世界中由巫师们骑着飞天扫帚参加的球类比赛),龙骑士们通过抓羊和把羊投入篮筐来得分,如果能抓到皮肤黝黑的沸羊羊还能获得额外的分数奖励。
现在有 喜洋洋、美羊羊、沸羊羊、懒羊羊、慢羊羊五种羊。分别代表得分:5分、8分、10分、15分、20分。但是如果一支队伍抓到的羊的数目大于等于10,并且有抓到沸羊羊,那么该只队伍得分增加50。
身为年轻英勇的维京勇士小嗝嗝的你,虽然你没有参加这场比赛,但你能帮助你的Girl Friend阿丝翠德数一数她们队一共得了几分吗?
#include <iostream>
#include "string"
using namespace std;
/**
* kkmd66 四刷
* @param str
* @return
*/
int score(const string &str) {
if (str == "Pleasant")
return 5;
if (str == "Pretty")
return 8;
if (str == "Athletic")
return 10;
if (str == "Lazy")
return 15;
if (str == "Slow")
return 20;
}
/**
* kkmd66 四刷
* @return
*/
int main() {
int n,count=0;
while (cin >> n) {
//计次
count++;
//计分
int sum = 0;
//是否有沸羊羊
bool flag = false;
for (int i = 0; i < n; ++i) {
string str,temp;
cin>>str>>temp;
if (str == "Athletic")
flag = true;
sum += score(str);
}
if (flag && n >= 10)
cout <<"Case #"<<count<<": "<< sum + 50 << endl;
else
cout <<"Case #"<<count<<": "<< sum << endl;
}
return 0;
}