#include <stdio.h> int main(){ int N,K,L; while(scanf("%d %d %d",&N,&K,&L)!=EOF&&((N||K||L)!=0)){ int i; for(i=2;i<N;i++){ if((2*K-K/2)>L) break; else{ K=2*K-K/2; } } printf("%d\n",K); } return 0; }
Double click to view unformatted code.