View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13