View Code of Problem 64

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

Double click to view unformatted code.


Back to problem 64