View Code of Problem 13

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,a,b,k,f=1;
	while(cin>>h>>a>>b>>k)
	{
		int flag=0;
		for(int i=1;i<=k;i++)
		{
			h-=a;
			if(h<1)
			{
				flag=1;
				break;
			}
			h+=b;
		}
		if(flag==1)
	   cout<<"Case #"<<f++<<": White win"<<endl;
	   else
	    cout<<"Case #"<<f++<<": Unknow"<<endl; 
	}
	return 0;}

Double click to view unformatted code.


Back to problem 13