View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13