View Code of Problem 9

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	int n;
	int k=1;
	while(scanf("%d",&n)!=EOF)
	{
		int sum=0;
		int i;
		int x=0,y=0,z=0,m=0,l=0;
		char a[10],b[10];
		for(i=0;i<n;i++)
		{
			scanf("%s %s",&a,&b);
			if(strcmp(a,"Pleasant")==0) x++;
		    if(strcmp(a,"Pretty")==0) y++;
			if(strcmp(a,"Athletic")==0) z++;
			if(strcmp(a,"Lazy")==0) m++;
			if(strcmp(a,"Slow")==0) l++;
		}
		sum=5*x+8*y+10*z+15*m+20*l;
		if(n>=10&&z!=0) sum+=50;
		printf("Case #%d: %d\n",k++,sum);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 9