View Code of Problem 9

#include <iostream>
#include <string.h>
using namespace std;

int main(){
    int n,score,m=0;
    char goat[10000][10],a[10];
    bool flag;
    while(scanf("%d",&n)!=EOF){
        score = 0;
        flag = false;
        for(int j = 0;j < n;j ++){
            scanf("%s%s",goat[j],a);
            if (strcmp(goat[j], "Pleasant") == 0)
                score += 5;
            else if (strcmp(goat[j], "Pretty") == 0)
                score += 8;
            else if (strcmp(goat[j], "Athletic") == 0){
                score += 10;
                flag = true;
            }
            else if (strcmp(goat[j], "Lazy") == 0)
                score += 15;
            else if (strcmp(goat[j], "Slow") == 0)
                score +=20;
        }
        
        if (flag&&n>=10) {
            score += 50;
        }
        
        m ++;
        printf("Case #%d: %d\n",m,score);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 9