Friday, April 24, 2015

UVa 11917 - Do Your Own Homework!

#include <iostream>
#include <string>
#include <map>
using namespace std;

int main() {
	int cases;
	cin >> cases;
	for (int cas = 1; cas <= cases; cas++) {
		map<string, int> time_spent_on;
		int n;
		for (cin >> n; n; n--) {
			string subject;
			int days;
			cin >> subject >> days;
			time_spent_on[subject] = days;
		}
		int days_to_deliver;
		cin >> days_to_deliver;
		string subject_to_deliver;
		cin >> subject_to_deliver;

		cout << "Case " << cas << ": ";
		if (time_spent_on.count(subject_to_deliver) == 0 || days_to_deliver + 5 < time_spent_on[subject_to_deliver])
			cout << "Do your own homework!";
		else if (days_to_deliver < time_spent_on[subject_to_deliver])
			cout << "Late";
		else
			cout << "Yesss";
		cout << endl;
	}

	return 0;
}

No comments:

Post a Comment