View Code of Problem 64

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,l;
	while(cin>>n>>k>>l)
	{
		if(n==0&&k==0&&l==0)
		break;
		int t;
		for(int i=1;i<=n-2;i++)
		{
			t=k/2;
			if(k-k/2+k>l)
			break;
			else
			k=k-t+k;
		}
		cout<<k<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 64