View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13