View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13