View Code of Problem 9

#include<stdio.h>
#include<string.h>
#define N 10000
#define LEN 20
#define S5 "Pleasant"   //喜洋洋5分
#define S8 "Pretty"
#define S10 "Athletic"
#define S15 "Lazy"
#define S20 "Slow"
int main(void)
{
    int n,count=0;
    int i,j,flag,sum;
    char goats[LEN];
    char pp[LEN];
    while(scanf("%d",&n)!=EOF)
    {
        count++;
        sum = 0;
        flag = 0;
        for(i=0; i<n&&i<N; ++i)
        {
            scanf("%s %s",goats,pp);
            if(strcmp(goats,S5)==0)
                sum+=5;
            if(strcmp(goats,S8)==0)
                sum+=8;
            if(strcmp(goats,S10)==0)
            {
                flag = 1;
                sum+=10;
            }
            if(strcmp(goats,S15)==0)
                sum+=15;
            if(strcmp(goats,S20)==0)
                sum+=20;
        }
        if(n>=10&&flag)
            sum+=50;
        printf("Case #%d: %d\n",count,sum);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 9