View Code of Problem 64

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

Double click to view unformatted code.


Back to problem 64