• + 0 comments
    def pageCount(n, p):
       
        is_odd = n % 2 != 0
        if p > n/2:
            if is_odd and n-p <= 1:
                return 0
            return math.ceil((n-p-1)/2) if is_odd else math.ceil((n-p)/2)
        return math.ceil((p-1)/2)