View Code of Problem 64

#include "stdio.h"
#include "math.h"
#include "string.h"

void main()
{
	int i,j,k;
	int n,l;
	int t;
	for(;scanf("%d%d%d",&n,&k,&l)!=EOF;)
	{
		if(n==0&&k==0&&l==0)
			break;
		for(i=0;i<n-2;i++)
		{
			t=k-k/2+k;
			if(t>l)
				break;
			k=t;
		}
		printf("%d\n",k);
	}
}

Double click to view unformatted code.


Back to problem 64