View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13