View Code of Problem 9

#include<stdio.h>
    #include<string.h>
    int main()
    {
    	char goat[100000][10] = {{'\0'}},a[10] = {'\0'};
    	int n,i,score = 0,flag = 0;
    	static 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+=5;
    			else if (strcmp(goat[i],"Pretty") == 0) score+=8;
    			else if (strcmp(goat[i],"Athletic") == 0)
    			{
    				score+=10;
    				flag = 1;
    			}
    			else if (strcmp(goat[i],"Lazy") == 0) score+=15;
    			else if (strcmp(goat[i],"Slow") == 0) score+=20;
    		}
    		if (n >= 10 && flag == 1) score+=50;
    		printf("Case #%d: %d\n",k++,score);
    		score = 0;
    		flag = 0;
    	}
    	return 0;
    }

Double click to view unformatted code.


Back to problem 9