View Code of Problem 13

#include <stdio.h>
int main()
{
	int h, a, b, k;
	int j = 1;
	while(scanf("%d%d%d%d", &h, &a, &b, &k) != EOF)
	{
		int hp = h;
		for(int i = 0; i < k; i++)
		{
			h -= a;
			if(h >= 1)
			{
				h += b;
			}
		}
		if(hp > h + b)
			printf("Case #%d: White win\n", j++);
		else
			printf("Case #%d: Unknow\n", j++);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 13