View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9