View Code of Problem 9

#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
int main(){
	int n;
	int count=0;
	while(scanf("%d",&n)!=EOF)
	{	
		count++;
		int score=0;
		char ch[1000];
		int falg=0;
		for(int i=0;i<n*2;i++)
		{
			scanf("%s",ch);
			int num=strlen(ch);
			if(num==8&&ch[0]=='P')
				score+=5;
			else if(num==6)
				score+=8;
			else if(num==8&&ch[0]=='A')
				{
					score+=10;
					falg=1;
				}
			else if(num==4&&ch[0]=='L')
				score+=15;
			else if(num==4&&ch[0]=='S')
				score+=20;
		}
		if(n>=10&&falg==1)
			score+=50;
		printf("Case #%d: %d\n",count,score);
	}
	
    return 0;
} 

Double click to view unformatted code.


Back to problem 9