View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9