View Code of Problem 9

#include <iostream>
#include <cstring>
using namespace std;
char a[10000];
int main(void){
	int n;
	int k=0;
	while(cin>>n){
		int temp=n;
		int total=0;
		int WWW=0;
	while(n--){
		cin>>a;
		if(a[0]=='L')	total+=15;
		else if(a[0]=='A') {total+=10; WWW++;} 
		else if(a[0]=='S') total+=20;
		else if(a[0]=='P'&&a[1]=='l') total+=5;
		else if(a[0]=='P'&&a[1]=='r') total+=8;
		else 
			return 0;
	}
	if(WWW>0&&temp>=10)
		total+=50;
	cout<<"Case #"<<++k<<": "<<total<<endl;
}
	return 0;
}

Double click to view unformatted code.


Back to problem 9