View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13