View Code of Problem 64

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;


int main()
{
	int N, K, L;

	while (cin >> N >> K >> L) {

		if (N == 0 && K == 0 && L == 0)
			break;

		int sum = K;

		while (N - 2 > 0) {

			int temp = sum;
			if (sum - temp / 2 + temp > L)
				break;

			sum = sum + temp - temp / 2;

			N--;
		}

		cout << sum << endl;
	}
}

Double click to view unformatted code.


Back to problem 64