View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13