View Code of Problem 13

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

}

Double click to view unformatted code.


Back to problem 13