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)) { int temp=K; for(int i=2;i<N;i++) { temp=temp*2-(int)(temp/2); if (temp>=L) { break; } K=temp; } System.out.println(K); N = scanner.nextInt(); K = scanner.nextInt(); L = scanner.nextInt(); } } } |
Double click to view unformatted code.