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-1; i++) {
			if(K+K-K/2<=L) K=2*K-K/2;
			else break;
		}
		cout<<K<<endl;
	}
}

Double click to view unformatted code.


Back to problem 64