View Code of Problem 9

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

int main() {
	int n,i;
	int count=0,flag=0,k=0;
	while(scanf("%d",&n)!=EOF){
		char a[1000];
		char g[1000];
		int goat=0;
		for(i=0;i<n;i++){
			scanf("%s %s",&a,&g);
			if(strcmp(a,"Pleasant")==0){
				goat=goat+5;
				count++;
			}
			else if(strcmp(a,"Pretty")==0){
				goat=goat+8;
				count++;
			}
			else if(strcmp(a,"Athletic")==0){
				goat=goat+10;
				count++;
				flag=1;
			}
			else if(strcmp(a,"Lazy")==0){
				goat=goat+15;
				count++;
			}
			else if(strcmp(a,"Slow")==0){
				goat=goat+20;
				count++;
			}
			
		}
		if(count>=10&&flag==1){
			goat=goat+50;
		}
		k++;
		printf("Case #%d: %d\n",k,goat);
		}
		
		
	}

Double click to view unformatted code.


Back to problem 9