View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9