#include <stdio.h> #include <string.h> #include <stdlib.h> int a[5]; int f[5] = {5, 8, 10, 15, 20}; int main() { int t; char n[100]; int kk = 0; while(scanf("%d", &t) != EOF) { kk++; for (int i = 0; i < 5; i++) { a[i] = 0; } getchar(); while (t--) { gets(n); if (strcmp(n, "Pleasant goat") == 0) { a[0]++; } else if(strcmp(n, "Pretty goat") == 0) { a[1]++; } else if(strcmp(n, "Athletic goat") == 0) { a[2]++; } else if(strcmp(n, "Lazy goat") == 0) { a[3]++; } else if(strcmp(n, "Slow goat") == 0) { a[4]++; } } int count = 0; if (a[2] > 0 && (a[0] + a[1] + a[2] + a[3] + a[4] >= 10)) { count += 50; } for (int i = 0; i < 5; i++) { count += a[i] * f[i]; } printf("Case #%d: %d\n", kk, count); } } |
Double click to view unformatted code.