#include<iostream> using namespace std; int main() { int n = 0; int case_count = 0; int point[] = { 5,8,10,15,20 }; char temp[10], goat[10]; while (scanf("%d", &n) != EOF) { int count[5] = { 0 }; case_count++;; for (int i = 0; i < n; ++i) { scanf("%s", temp); scanf("%s", goat); switch (temp[3]) { case 'a':count[0]++; break; case 't':count[1]++; break; case 'l':count[2]++; break; case 'y':count[3]++; break; case 'w':count[4]++; break; } } int total = point[0] * count[0] + point[1] * count[1] + point[2] * count[2] + point[3] * count[3] + point[4] * count[4]; if (count[0] + count[1] + count[2] + count[3] + count[4] > 10 && count[2] != 0) total += 50; printf("Case #%d: %d\n",case_count, total); } return 0; } |
Double click to view unformatted code.