import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int K = scanner.nextInt(); int L = scanner.nextInt(); while (!(N == 0 && K == 0 && L == 0)) { for(int i=2;i<N;i++) { K=K-(int)(K/2)+K; if (K>=L) { K=L; break; } } System.out.println(K); N = scanner.nextInt(); K = scanner.nextInt(); L = scanner.nextInt(); } } } |
Double click to view unformatted code.