View Code of Problem 13

#include <stdio.h>

int main(){
	int h,a,b,k;
	int count=1; 
	while(scanf("%d %d %d %d",&h,&a,&b,&k)!=EOF){
		int flag=0;
		for(int i=0;i<k;i++){
			h=h-a;
			if(h<1){
				flag=1;
				break;
			}
			h=h+b;

		}
		if(flag==1){
			printf("Case #%d: White win",count);
		}
		else{
			printf("Case #%d: Unknow",count);
		}
		count++;
	}
	 
}

Double click to view unformatted code.


Back to problem 13