View Code of Problem 13

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

Double click to view unformatted code.


Back to problem 13