View Code of Problem 64

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

Double click to view unformatted code.


Back to problem 64