View Code of Problem 9

#include<bits/stdc++.h>
using namespace std;
#define max 100000
int main(){
	int n,score = 0,num = 0,slow = 0,j = 1;
	string s;
	while(scanf("%d",&n)!=EOF){
			getchar();
		for(int i = 0;i<n;i++){
				getline(cin,s);
			if(s == "Pleasant goat"){
				num++;
				score += 5;
			}else if(s=="Pretty goat"){
				num++;
				score += 8;
			}else if(s=="Athletic goat"){
				num++;
				score += 10;
				slow = 1;
			}else if( s == "Lazy goat" ){
				num++;
				score += 15;
			}else if( s == "Slow goat" ){
				num++;
				score += 20;
			}	
		}
		if(n >= 10 && slow == 1) score += 50;
		printf("Case #%d: %d\n",j++,score);
		slow = 0;
		num = 0;
		score = 0;	
	}
	return 0;
	
}

Double click to view unformatted code.


Back to problem 9