• + 0 comments
    var page = 1;
    var result = 0;
    for (int i = 0; i < n; i++)
    {
        var index = 1;
        while (index <= arr[i])
        {
            if (page == index)
                result++;
            if (index % k == 0 && index != arr[i])
                page++;
            index++;
        }
        page++;
    }
    return result;