View Code of Problem 13

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan=new Scanner(System.in);
		int k,a,b,h;
		int sign=0;
		while(scan.hasNext()){
			h=scan.nextInt();
			a=scan.nextInt();
			b=scan.nextInt();
			k=scan.nextInt();
			sign++;
			if(h<=a)
				System.out.println("Case #"+sign+": White win");
			else if( h-k*a+(k-1)*b<=0 )
				System.out.println("Case #"+sign+": White win");
			else if( k*a-(k+1)*b>0 )
				System.out.println("Case #"+sign+": White win");
			else
				System.out.println("Case #"+sign+": Unknow");
		}
	}

}

Double click to view unformatted code.


Back to problem 13