View Code of Problem 9

#include<stdio.h>
#include<string.h>
int main(){
	int n,num = 0;
	while(scanf("%d",&n)!=EOF){
		num++;
		char name[20];
		char name2[20];
		int flag = 0,score = 0,count = 0;             //未抓到沸羊羊 
		while(n--){
			scanf("%s",name);
			scanf("%s",name2);
			int len = strlen(name);
			if(strcmp(name,"Pleasant")==0){
				score+=5;
				count++;
			}
			else if(strcmp(name,"Pretty")==0){
				score+=8;
				count++;
			}
			else if(strcmp(name,"Athletic")==0){
				score+=10;
				count++;
				flag = 1;
			}
			else if(strcmp(name,"Lazy")==0){
				score+=15;
				count++;
			}
			else if(strcmp(name,"Slow")==0){
				score+=20;
				count++;
			}
		}
		if(count>=10&&flag==1){
				score+=50;
			}
		printf("Case #%d: %d\n",num,score);
	}
} 

Double click to view unformatted code.


Back to problem 9