数数小绵羊

  • Post author:
  • Post category:其他


#include <stdio.h>
#include <string.h>
int main(){
    int n,k=0,score,tag=0;
    char *xi="Pleasant",*mei="Pretty",*fei="Athletic",*lan="Lazy",*man="Slow";
    while(scanf("%d",&n)!=EOF){
        getchar();
        char catch[n][10];			//不能使用gets();
        score=0;
        for(int i=0;i<n;i++) {
            scanf("%s goat",catch[i]);
            if (strcmp(catch[i], xi) == 0){
                score+=5;
            }
            else if(strcmp(catch[i], mei) == 0){
                score+=8;
            }
            else if(strcmp(catch[i], fei) == 0){
                score+=10;
                tag=1;
            }
            else if(strcmp(catch[i], lan) == 0){
                score+=15;
            }
            else if(strcmp(catch[i], man) == 0){
                score+=20;
            }
        }
        if(n>=10&&tag){
            score+=50;
        }
        printf("Case #%d: %d\n",++k,score);
    }
    return 0;
}



版权声明:本文为Jay98原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。