View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9