View Code of Problem 9

#include<stdlib.h>
#include<stdio.h>
#include<string.h>

int main(){
	int N;
	char sheep[20],shee[20];
	int count=0;
	while((scanf("%d",&N)!=EOF)){
		count++;
		int flag = 0;
		int score = 0;
		
		for(int i=0; i<N; i++){
			scanf("%s %s",sheep,shee);
			if(sheep[0]=='P'){
				if(sheep[1]=='l')
					score += 5;
				else
					score += 8;
			}else if(sheep[0]=='A'){
				flag = 1;
				score += 10;

			}else if(sheep[0]=='L'){
				score += 15;
			}else if(sheep[0]=='S'){
				score += 20;
			}
		}
		if(N>=10 && flag==1)
			score += 50;
	
		printf("Case #%d: %d\n",count,score);
	}


	return 0;
}

Double click to view unformatted code.


Back to problem 9