Monday, February 15, 2016

UVa 11608 - No Problem

// UVa 11608 - No Problem
#include <iostream>
using namespace std;

#define integer signed long long int

int main() {
	integer supply, t = 0;
	while (cin >> supply && supply >= 0) {
		t++;
		cout << "Case " << t << ":" << endl;
		integer books[12];
		for (int i = 0; i < 12; i++)
			cin >> books[i];
		for (int i = 0; i < 12; i++) {
			integer need;
			cin >> need;
			if (need > supply)
				cout << "No problem. :(" << endl;
			else {
				cout << "No problem! :D" << endl;
				supply -= need;
			}
			supply += books[i];
		}
	}
	return 0;
}

No comments:

Post a Comment