View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13