View Code of Problem 13

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

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

Double click to view unformatted code.


Back to problem 13