View Code of Problem 13

#include<stdio.h>
int main(){
	int  h,a,b,k;   //黑龙初始血量、白龙攻击、黑龙回复、回合数
	int count=0;
	while(scanf("%d %d %d %d",&h,&a,&b,&k)!=EOF) {
		    count++;
		    int i;
			for(i=0;i<k;i++){
				if(h-a<1){
					printf("Case #%d: White win\n",count);
					break;
				}
                else{
					h=h-a+b;
				}
           	}
           	if(i==k)
			printf("Case #%d: Unknow\n",count);	
	} 
}

Double click to view unformatted code.


Back to problem 13