View Code of Problem 13

#include<stdlib.h>
#include<stdio.h>
#include<string.h>

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

	return 0;
}

Double click to view unformatted code.


Back to problem 13