View Code of Problem 13

#include <stdio.h>
typedef struct example{
	int k,a,b,h,flag;
}example;
int main(){
	int i,n=0;
  	example num[10];
  	while(scanf("%d%d%d%d",&num[n].h,&num[n].a,&num[n].b,&num[n].k) != EOF){
    
        	if(num[n].h <= num[n].a)
                  num[n].flag = 0;
          	else if(num[n].h - (num[n].a - num[n].b) * num[n].k <= 0)
                  num[n].flag = 0;
                else if(num[n].a *2 < num[n].b *3)
                  num[n].flag = 0;
                else num[n].flag = 1;
                n++;
        }
      for(i=0; i<=n;i++){
          switch(num[i].flag){
          	case 0:
            		printf("Case #%d: White win\n",i);      
            	case 1:
            		printf("Case #%d: Unknow\n",i);
          }
      }
  return 0;
}

Double click to view unformatted code.


Back to problem 13