View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9