#include <stdio.h> #include <malloc.h> #include <string.h> #define MAX 100000 char q[5][20]={"Pleasant goat\n","Pretty goat\n","Athletic goat\n","Lazy goat\n","Slow goat\n"}; char p[20]; int a[10001][6]; int b[5]={5,8,10,15,20}; int main() { int n, i, j, pos = 0, lll; long long sum = 0; //fgets(p,20,stdin); //while (p[0]<='9' && p[0]>='0') while(scanf("%d",&n)!=EOF) { //scanf("%d",&n); //fgets(p,20,stdin); //i = 0; //n=0; /*while (p[i]<='9' && p[i]>='0') { n = (p[i] - '0')+ n*10; i++; }*/ for (i=0; i<n; i++) { fgets(p,20,stdin); for (j=0; j<5; j++) { if (strcmp(q[j],p) == 0) { a[pos][j]++; a[pos][5]++; break; } } } pos++; //fgets(p,20,stdin); } for (i=0; i<pos; i++) { if (a[i][5]>9&&a[i][2]>0) sum+=50; for (j=0; j<5; j++) sum += b[j] * a[i][j]; printf("Case #%d: %lld\n",(i+1),sum); sum = 0; } return (0); } |
Double click to view unformatted code.