View Code of Problem 13

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>
typedef struct{
	char name[20];
	int flag;
}Children;

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




	

Double click to view unformatted code.


Back to problem 13