View Code of Problem 13

#include<stdio.h>
int main(){
  int h,a,b,k,flag;
  int num=1;
  
  while(scanf("%d%d%d%d",&h,&a,&b,&k)!=EOF){
    flag=0;
    
    for(int i=1;i<=k;i++){//白龙攻击黑龙回合
      h=h-a;
      if(h<1){
        flag=1;
        break;
      }
      h=h+b;
    }
    
    if(flag==0)
      printf("Case #%d: Unknow\n",num++);
    else
      printf("Case #%d: White win\n",num++);
  }
  return 0;
}

Double click to view unformatted code.


Back to problem 13