Codeforce round 667 pro. C (tutorial) https://codeforces.com/contest/1409/problem/C

here is the codeforce div 2 round 667 pro. C
Problem - C - Codeforces

and here is the solution or tutorial link

int main() {
int tcs;
cin >> tcs;

while (tcs--) {
    int n, x, y;
    cin >> n >> x >> y;
    int diff = y - x;
    for (int delta = 1; delta <= diff; ++delta) {
        if (diff % delta) continue;
        if (diff / delta + 1 > n) continue;
        int k = min((y - 1) / delta, n - 1);
        int a0 = y - k * delta;
        for (int i = 0; i < n; ++i) {
            cout << (a0 + i * delta) << ' ';
        }
        cout << endl;
        break;
    }
}

}

i can’t understand why there is line in code
int k = min((y - 1) / delta, n - 1);
int a0 = y - k * delta;

please help me please
and thanks for your help

1 Like