View Code of Problem 9

#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int score(int n,string name){
	if(name=="Pleasant"){
		return 5;
	}
	else if(name=="Pretty"){
		return 8;
	}
	else if(name=="Athletic"){
		return 10;
	}
	else if(name=="Lazy"){
		return 15;
	}
	else if(name=="Slow"){
		return 20;
	}
}

int main(){
	int n;
	int count=0;
	while(cin>>n){
//		getchar();
		count++;
		int mark=0;
		int flag=0;
		for(int i=0;i<n;i++){
			string goat;
			string kk;
			cin>>goat>>kk;
			if(goat=="Athletic"&&flag==0){
				flag=1;
			}
			mark+=score(n,goat);
		}
		if(flag&&n>=10){
			mark+=50;
		}
		cout<<"Case #"<<count<<": "<<mark<<endl;
	}
}

Double click to view unformatted code.


Back to problem 9