View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9