View Code of Problem 64

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

	return 0; 
}

Double click to view unformatted code.


Back to problem 64