View Code of Problem 13

#include <stdio.h>
int main(){
  int h,a,b,k,count=0
  while(~scanf("%d %d %d %d",&h,&a,&b,&k)){
    int t=1;
     count++;
    while(k--){
      h=h-a;
      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);
  }

}
/*
Main.c: In function 'main':
Main.c:4:3: error: expected ',' or ';' before 'while'
   while(~scanf("%d %d %d %d",&h,&a,&b,&k)){
   ^
Main.c:3:15: warning: unused variable 'count' [-Wunused-variable]
   int h,a,b,k,count=0
               ^
Main.c:3:13: warning: unused variable 'k' [-Wunused-variable]
   int h,a,b,k,count=0
             ^
Main.c:3:11: warning: unused variable 'b' [-Wunused-variable]
   int h,a,b,k,count=0
           ^
Main.c:3:9: warning: unused variable 'a' [-Wunused-variable]
   int h,a,b,k,count=0
         ^
Main.c:3:7: warning: unused variable 'h' [-Wunused-variable]
   int h,a,b,k,count=0
       ^
*/

Double click to view unformatted code.


Back to problem 13