View Code of Problem 9

#include <stdio.h>

int main ()
{
	int t,sum,flag,i,num;
	char str[100];
	
	while (scanf ("%d",&t)!=EOF){
		getchar ();
		num = 1;
		sum = 0;
		flag = 0;
		for (i=0;i<t;i++){
			gets (str);
			if (str[0] == 'P' && str[1] == 'l')  sum+=5;
			else if (str[0] == 'P' && str[1] == 'r') sum+=8;
			else if (str[0] == 'A' && str[1] == 't'){
				sum+=10;
				flag++;
			}
			else if (str[0] == 'L' && str[1] == 'a') sum+=15;
			else sum+=20;
		}
		printf ("Case #%d: ",num);
		if (t>=10 && flag != 0) printf ("%d\n",sum+50);
		else printf ("%d\n",sum);
		num++;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 9