View Code of Problem 64

import java.util.Scanner;
public class Main {
	    public static void main(String[] args) {
	        Scanner scanner=new Scanner(System.in);
	        while(scanner.hasNext()){
	            int M=scanner.nextInt();
	            int k=scanner.nextInt();
	            int L=scanner.nextInt();
	            if(k==0&&M==0&&L==0){
	                break;
	            }
	            for(int i=2;i<M;i++){
	                if(k-k/2+k >L)
	                    break;
	 
	                k=k-k/2+k;
	            }
	            System.out.println(k);
	        }
	    }
	
}

Double click to view unformatted code.


Back to problem 64