View Code of Problem 64

    #include<iostream>
    using namespace std;
    int main(){
    	int n,k,L;
    	
    	while(cin>>n>>k>>L){
    		if(n==0&&k==0&&L==0)
				break;
    		for(int i=2;i<n;i++){
    			if(k-k/2+k>L)
					break;
    			k=k-k/2+k;
    		}
    		cout<<k<<'\n';
    		
    	}
    	return 0;
    }

Double click to view unformatted code.


Back to problem 64