View Code of Problem 13

#include <stdio.h>
int main(){
	int h,a,b,k,count=0,t;
	while(~scanf("%d %d %d %d",&h,&a,&b,&k)){
		count++;
		t=1;
		while(k--){
			h=h-a;
			if(h<1){
				t=0;
				break;
			}
			else h=h+b;
		}
		if(t==1) printf("Case #%d: Unknow\n",count);
		else printf("Case #%d: White win\n",count);
	}
}

Double click to view unformatted code.


Back to problem 13