View Code of Problem 13

#include<stdio.h>

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

Double click to view unformatted code.


Back to problem 13