View Code of Problem 64

#include <iostream>
#include <cstdio>
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=0;i<N-2;i++){
            if(k-k/2+k<=L)
                k=k-k/2+k;
            }
        cout<<k<<endl;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 64