#include<stdio.h> #include<string.h> struct Yang { char s[100]; char p[100]; }; int main(void) { int n,k=1; char c1[20]="Pleasant",c2[20]="Pretty",c3[20]="Athletic",c4[20]="Lazy",c5[20]="Slow"; while(scanf("%d",&n)!=EOF) { struct Yang y[n]; int i,a=0,b=0,c=0,d=0,e=0,flag=0,sorce=0; for(i=0;i<n;i++) { scanf("%s %s",y[i].s,y[i].p); } for(i=0;i<n;i++) { if(strcmp(y[i].s,c1)==0) a++; if(strcmp(y[i].s,c2)==0) b++; if(strcmp(y[i].s,c3)==0) c++; flag=1; if(strcmp(y[i].s,c4)==0) d++; if(strcmp(y[i].s,c5)==0) e++; } if((a+b+c+d+e)>=10&&flag==1) { sorce=a*5+b*8+c*10+d*15+e*20+50; } else { sorce=a*5+b*8+c*10+d*15+e*20; } printf("Case #%d: %d",k,sorce); k++; printf("\n"); } } |
Double click to view unformatted code.