View Code of Problem 9

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	//int a[100000];
	int k = 0;
	while (cin >> n) {
		string s[2];
		int gra = 0;
		int flag = 0;
		k++;
		for (int i = 0; i < n; i++)
		{
			cin >> s[0] >> s[1];
			if (s[0] == "Pleasant") {
				gra += 5;
			}
			if (s[0] == "Pretty") {
				gra += 8;
			}
			if (s[0] == "Athletic") {
				gra += 10;
				flag = 1;
			}
			if (s[0] == "Lazy") {
				gra += 15;
			}
			if (s[0] == "Slow") {
				gra += 20;
			}
			//cout << gra << endl;
		}
		if (flag == 1 && n >= 10) {
				gra += 50;
		}
		cout << "Case #" << k << ": " << gra<<endl;
	}
}

Double click to view unformatted code.


Back to problem 9