View Code of Problem 9

#include<iostream>
#include<string>
using namespace std;

int main(){
	int n, i, k, score, num;
	bool getAthletic;
	string g[5] = {"Pleasant", "Pretty", "Athletic", "Lazy", "Slow"};
	string goat, kind;
	k = 0;
	while(scanf("%d",&n)!=EOF){
		k++;
		score = 0;
		getAthletic = false;
		num = 0;
		for(i=0;i<n;i++){
			cin >> kind >> goat;
			if(kind == g[0]){
				score += 5;
				num++;
			}
			else if(kind == g[1]){
				score += 8;
				num++;
			}
			else if(kind == g[2]){
				score += 10;
				getAthletic = true;
				num++;
			}
			else if(kind == g[3]){
				score += 15;
				num++;
			}
			else if(kind == g[4]){
				score += 20;
				num++;
			}
		}
		if(getAthletic&&num>=10)
			score += 50;
		cout << "Case #" << k << ": " << score << endl;

	}
	return 0;
}

Double click to view unformatted code.


Back to problem 9