View Code of Problem 13

#include<stdio.h>

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

Double click to view unformatted code.


Back to problem 13