View Code of Problem 9

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int cnt = 0;
    int flag = 0;
    int num;
    char c[15], d[15];
    scanf("%d",&num);
    do{
            int mark = 0;
            int i = num;
            while(num--){
                scanf("%s %s",&c,&d);
                if(strcmp(c,"Pleasant") == 0){
                    mark+=5;
                }else if(strcmp(c,"Pretty")==0){
                    mark+=8;
                }else if(strcmp(c,"Athletic")==0){
                    flag = 1;
                    mark+=10;
                }else if(strcmp(c,"Lazy")==0){
                    mark+=15;
                }else if(strcmp(c,"Slow")==0){
                    mark+=20;                }
            }
            if(i >= 10 &&flag == 1){
                mark += 50;
            }
            printf("Case #%d: %d\n",++cnt,mark);

    }while(scanf("%d",&num)!= EOF);

    return 0;
}

Double click to view unformatted code.


Back to problem 9