View Code of Problem 64

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

Double click to view unformatted code.


Back to problem 64