View Code of Problem 9

#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
	map<string,int> m;
	m["Pleasant"]=5;
	m["Pretty"]=8;
	m["Athletic"]=10;
	m["Lazy"]=15;
	m["Slow"]=20;
	int n,j=0;
	while(scanf("%d",&n)!=EOF)
	{
		int sum=0,count=0,flag=0;
		for(int i=0;i<n;i++)
		{
			string a,b;
			cin>>a>>b;
			sum=sum+m[a];
			count++;
			if(a=="Athletic")
			{
				flag=1;
			}
		}
		if(count>=10&&flag==1)
		{
			sum=sum+50;
		}
		printf("Case #%d: %d\n",++j,sum);
	}
	
	return 0;

}

Double click to view unformatted code.


Back to problem 9