View Code of Problem 9

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,cnt=1;
	while(scanf("%d",&n)!=EOF){
		char a[n],b[n];
		int sum=0,flag=0;
		getchar();
		for(int i=0;i<n;i++){
			scanf("%s %s",a,b);
			if(strcmp("Pleasant",a)==0)
				sum+=5;
			else if(strcmp("Pretty",a)==0)
				sum+=8;
			else if(strcmp("Athletic",a)==0){
				sum+=10;
				flag=1;
			}else if(strcmp("Lazy",a)==0)
				sum+=15;
			else if(strcmp("Slow",a)==0)
				sum+=20;
		}
		if(flag==1&&n>=10)
			sum+=50;
		printf("Case #%d: %d\n",cnt++,sum);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 9