View Code of Problem 64

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <iomanip>
#include<vector>
#include<math.h>
using namespace std;
int main()
{
	int n, k, l;
	while (cin >> n >> k >> l) {
		if (n == 0 && k == 0 && l == 0) {
			break;
		}
		n = n - 2;
		while (n--) {
			if (k - k / 2 + k > l) {
				//cout << k;
				break;
			}
			else k = k - k / 2  + k;
		}
		
		cout << k<<endl;
	}
}

Double click to view unformatted code.


Back to problem 64