View Code of Problem 9

#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,count=1;
	while(cin>>n) {
		int flag=0, sum=0;
		string s,s2;
		getchar();
		for(int i=0; i<n; i++) {
			cin>>s>>s2;
			if(s=="Pleasant") {
				sum+=5;
			}else if(s=="Pretty") {
				sum+=8;
			}else if(s=="Athletic") {
				sum+=10;
				flag=1; 
			}else if(s=="Lazy") {
				sum+=15;
			}else if(s=="Slow") {
				sum+=20;
			}
		}
		if(n>=10&&flag==1) sum+=50;
		cout<<"Case #"<<count++<<": "<<sum<<endl; 
	} 
}

Double click to view unformatted code.


Back to problem 9