View Code of Problem 64

import java.util.Scanner;
public class Main{
  public static void main(String args[]) {
    int k, L, n;
    Scanner sc=new Scanner(System.in);
    n=sc.nextInt();
		  k=sc.nextInt();
	  	L=sc.nextInt();
    for (int i = 1; i <= n; i++) 
		 	{
							if (2 * k - k / 2 > L)
							{	
									break;
							}
							else
							{
										k = 2 * k - k / 2;
							}
				}
				System.out.println(k);
		}
}

Double click to view unformatted code.


Back to problem 64