View Code of Problem 64

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);
	}
}
/*
Main.java:4: error: cannot find symbol
		Scanner sc=new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner sc=new Scanner(System.in);
		               ^
  symbol:   class Scanner
  location: class Main
2 errors
*/

Double click to view unformatted code.


Back to problem 64