View Code of Problem 64

#include <iostream>
#include <cmath>

using namespace std;

/**
 * kkmd66
 * @return 
 */
int main() {

    int N, k, L;
    while (cin >> N >> k >> L) {
        if (N == 0 && k == 0 && L == 0)
            break;
        //N-2个车站
        for (int i = 0; i < N - 2; ++i) {
            int temp = k - floor(k / 2) + k;
            if (temp > L)
                break;
            k = temp;
        }

        cout << k << endl;
    }

    return 0;
}

Double click to view unformatted code.


Back to problem 64