View Code of Problem 13

#include<stdio.h>
#include<malloc.h>
#include<string.h>
#include<math.h>



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

	}
	

}

Double click to view unformatted code.


Back to problem 13