View Code of Problem 9

#include<stdio.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
int main() {

	int a = 0, b = 0, c = 0, d = 0, e = 0;
	int k = 1, n, sum;
	char B[10000];
	while (scanf("%d", &n) != EOF) {
		while (n--) {
			scanf("%s", B);
			if (strcmp(B, "Pleasant") == 0) {
				a++;
			}
			else if (strcmp(B, "Pretty") == 0) {
				b++;
			}
			else if (strcmp(B, "Athletic") == 0) {
				c++;
			}
			else if (strcmp(B, "Lazy") == 0) {
				d++;
			}
			else if (strcmp(B, "Slow") == 0) {
				e++;
			}

		}

		sum = a * 5 + b * 8 + c * 10 + d * 15 + e * 20;
		if ((a + b + c + d + e >= 10) && (c > 0)) {
			sum = sum + 50;
		}

		printf("Case #%d: %d\n", k, sum);
		k++;

	}
	return 0;

}

Double click to view unformatted code.


Back to problem 9