View Code of Problem 9

#include<stdio.h>
#include<string.h>
int main(void)
{
  int n,score,sharp=0,flag;
  while(~scanf("%d",&n))
  {
    ++sharp;
    flag=-1;
    score=0;
    char s1[20],s2[20];
    for(int i=0;i<n;i++)
    {
      scanf("%s %s",s1,s2);
      if(strcmp(s1,"Pleasant")==0)
        score+=5;
      else if(strcmp(s1,"Pretty")==0)
        score+=8;
      else if(strcmp(s1,"Athletic")==0)
      {
        score+=10;
        flag=1;
      }
      else if(strcmp(s1,"Lazy")==0)
        score+=15;
      else if(strcmp(s1,"Slow")==0)
        score+=20;     
    }
    if(n>=10&&flag)
      score+=50;
    printf("Case #%d: %d\n",sharp,score);
  }
}

Double click to view unformatted code.


Back to problem 9