View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13