View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9