View Code of Problem 64

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

Double click to view unformatted code.


Back to problem 64