View Code of Problem 13

#include "stdlib.h"
#include "algorithm"
#include "iostream"
#include <cstdio>
#include "string"
#include <iomanip>
#include <map>
#include <set>
#include "math.h"
using namespace std;
map<char, int> mp;
set<string> st;
int main()
{
	int h, a, b, k,c=1;
	while (cin >> h >> a >> b >> k)
	{
		while (k--)
		{
			h -= a;
			if (h < 1)
			{
				cout << "Case#" << c++ << ": White win"<<endl;
				break;
			}
			else h += b;
		}
		if (h >= 1)cout << "Case#" << c++ << ": Unknow"<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 13