def woodCut(self, L, k):
        """

        :param L: Given n pieces of wood with length L[i]
        :param k: An integer
        :return: The maximum length of the small pieces.
        """
        if not L:
            return 0
        maxa = max(L)
        lo = 0
        hi = maxa+1
        while lo < hi:
            m = (lo+hi)/2
            if m == 0:
                return m
            cnt = 0
            for l in L:
                cnt += l/m
            if cnt >= k:
                lo = m+1
            else:
                hi = m

        return lo-1
dataset/ETHPy150Open algorhythms/LintCode/Wood Cut.py/Solution.woodCut/original