View Code of Problem 9

#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
	int n;
	int k=1;
	while(scanf("%d",&n)!=EOF){
	char s[1000];
	char b[1000];
	int flag=0;
	int sum=0;
	int i;
	for(i=0;i<n;i++){
		scanf("%s%s",s,b);
	if(strcmp(s,"Pleasant")==0){
		sum+=5;
	}else if(strcmp(s,"Pretty")==0){
		sum+=8;
	}else if(strcmp(s,"Athletic")==0){
		sum+=10;
		flag=1;
	}else if(strcmp(s,"Lazy")==0){
		sum+=15;
	}else if(strcmp(s,"Slow")==0){
		sum+=20;
	}
	
} 
	if(n>=10&&flag==1){
		sum+=50;
		printf("Case #%d: %d\n",k++,sum);
	}else{
		printf("Case #%d: %d\n",k++,sum);
	}
	 
   }
	return 0;
}

Double click to view unformatted code.


Back to problem 9