#include<stdio.h> #include <string.h> #include <math.h> int main(){ int h,a,b,k; while(scanf("%d%d%d%d",&h,&a,&b,&k)!=EOF){ int t; int i,j=1; for(i=1;;i++){ if(i%(k+1)==0){ h=h+b; if(h>=t){ printf("Case #%d: Unknow\n",j++); break; } if(h<1){ printf("Case #%d: White win\n",j++); break; } } else{ h=h-a; if(h<1){ printf("Case #%d: White win\n",j++); break; } h=h+b; } } } printf("\n"); return 0; } |
Double click to view unformatted code.