View Code of Problem 64

#include<iostream>
using namespace std;
int main()
{
	int n,k,l,sum;
	while(cin>>n>>k>>l&&(n!=0||k!=0||l!=0))
	{  sum=k;
		for(int i=2;i<n;i++)//第一站和最后一战不上下人 
		{
			if(sum- sum/2+k>l)
			   break;
			   
			sum=sum-sum/2+sum;
			
		}
		cout<<sum<<endl;
	}
 } 

Double click to view unformatted code.


Back to problem 64