View Code of Problem 64

#include <stdio.h>
int main(){
	int N,k,L;
	while(scanf("%d %d %d",&N,&k,&L)!=EOF&&(N||k||L)){
		int i;
		for(i=2;i<=N-1;i++){
			if(k-k/2+k>L) break;
			else k=2*k-k/2;
		}
		printf("%d\n",k);
	}
} 

Double click to view unformatted code.


Back to problem 64