View Code of Problem 13

#include<iostream>
using namespace std;
 int main(){
	 int n,h,a,b,k,i;
	 i=0;
	while(scanf("%d %d %d %d",&h,&a,&b,&k)!=EOF)
	{
		i++;
		if(a>h)
		{
			printf("Case #%d: White win\n",i);
			continue;
		}
		int j;
		for(j=0;j<k;j++)
		{
			h-=a;
			if(h<=0)
			{
				printf("Case #%d: White win\n",i);
				break;
			}
			h+=b;
		}
		if(j==k)
			printf("Case #%d: Unknow\n",i);		
	} 
 	return 0;
 }

Double click to view unformatted code.


Back to problem 13