View Code of Problem 9

#include<iostream>
#include <stdio.h>
#include <string.h>
using namespace std;


int main() {
	int n,m,x;
	int j = 0;
	while (scanf("%d", &n)!= EOF) {	
		char s1[100];
		int goal = 0;
		int ath = 0;
		char temp[10];
		j++;
		for (int i = 0; i < n; i++) {
			scanf("%s%s",s1,temp);
			if (s1[3] == 'a') {
				goal += 5;
			}
			else if (s1[3] == 't') {
				goal += 8;
			}
			else if (s1[3] == 'l') {
				goal += 10;
				ath++;
			}
			else if (s1[3] == 'y') {
				goal += 15;
			}
			else if (s1[3] == 'w') {
				goal += 20;
			}
		}
		if (n >= 10 && ath > 0)
			goal += 50;
		printf("Case #%d: %d\n",j,goal);
	
	}
	return 0;
}	

Double click to view unformatted code.


Back to problem 9