View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13