View Code of Problem 9

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <stack>
#include <map>
#include <set>
#include <queue>
using namespace std;

int change(string a)
{
    if(a=="Pleasant") return 5;
    else if(a=="Pretty") return 8;
    else if(a=="Athletic")  return 10;
    else if(a=="Lazy") return 15;
    else return 20;
}

int main()
{
    #ifdef  ONLINE_JUDGE
    #else
    freopen("1.txt","r",stdin);
    #endif
    int n;
    int index=0;
    while(cin>>n)
    {
        index++;
        bool flag=0;
        int ans=0;
        for(int i=0;i<n;i++)
        {
            string t,str;
            cin>>str>>t;
            if(str=="Athletic") flag=1;
            ans+=change(str);
        }
        if(n<10) flag=0;
        if(flag==1) ans+=50;
        cout<<"Case #"<<index<<": "<<ans;
        cout<<endl;
    }



    return 0;
}

Double click to view unformatted code.


Back to problem 9