View Code of Problem 9

#include <stdio.h>
#include <string.h>
int main()
{
	char goat[10000][10]={{'\0'}} ,a[10]={'\0'} ;//ÃàÑôÊý×éΪ¶þάÊý×é 
	int n, i, score = 0,flag = 0;
    int k = 1;
	while(scanf("%d",&n) != EOF)
	{
		for(i=0;i<n;++i)
		{
			scanf("%s%s",goat[i],a);
			if( strcmp(goat[i],"Pleasant") == 0 )       score = score + 5;
			else if( strcmp(goat[i],"Pretty" ) == 0 )   score = score + 8;
			else if( strcmp(goat[i],"Athletic" ) == 0 )   
			    {
			    	score = score + 10;
			    	flag = 1;
				}
			else if( strcmp(goat[i],"Lazy") == 0 )      score = score + 15;
			else if( strcmp(goat[i],"Slow") == 0)       score = score + 20;
		}
		if(n>=10&&flag==1)  score = score +50;
		printf("Case #%d: %d",k,score);
		k++; 
		score = 0;
		flag = 0;
	}
	return 0; 
}

Double click to view unformatted code.


Back to problem 9