View Code of Problem 64

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int l = sc.nextInt();
            if (n == 0 && k == 0 && l == 0)
                break;
            for (int i = 2; i < n; 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