View Code of Problem 9

//pleasant goat :5分
//pretty goat : 8分
//athletic goat: 10分
//lazy goat:15分
//slow goat:20分
//如果抓到羊的总数大于等于10,并且有抓到沸羊羊,得分再增加50;

#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
	int n,m,i,count,tag=0;
	string s;
	while(cin>>n){
		getchar();
		tag++;
		count=0;
		for(i=0;i<n;++i){
			getline(cin,s);
			if(s=="Pleasant goat")	count+=5;
			else if(s=="Pretty goat")	count+=8;			
			else if(s=="Lazy goat")		count+=15;
			else if(s=="Slow goat")		count+=20;
			else{
				count+=10;
				if(n>=10)	count+=50;
			}						
		}
		printf("Case #%d: %d\n",tag,count);
	}
 } 

Double click to view unformatted code.


Back to problem 9