View Code of Problem 13

#include<iostream>
using namespace std;

int main()
{
	int h, a, b, k;
	int s = 1;
	while(cin >> h >> a >> b >> k)
	{
		cout << "Case #" << s ++ <<": "; 
		bool flag = true;
		for(int i = 0;i < k;i ++)
		{
			h -= a;
			if(h < 1)
			{
				flag = false;
				break;
			}
			else h += b;
		}
		if(!flag) cout << "White win";
		else cout << "Unknow";
		cout << endl;
	}
	return 0;
}


Double click to view unformatted code.


Back to problem 13