View Code of Problem 13

#include <stdio.h>

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

Double click to view unformatted code.


Back to problem 13