View Code of Problem 64

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

Double click to view unformatted code.


Back to problem 64