View Code of Problem 64

#include <stdio.h>
using namespace std;
int main(){
	
	int N,k,L;
	while( scanf("%d%d%d", &N, &k, &L )){
		if( N==0 && k==0 && L == 0 ){
			break;
		}
		int cnt = 1;
		while( k-k/2+k <= L && cnt <N-1 ){
			k = k- k/2+k;
			cnt ++;
		}
		printf("%d\n", k );
		
	}

	return 0;
	
}

Double click to view unformatted code.


Back to problem 64