<reponame>ferhatelmas/algo<filename>topCoder/srms/300s/srm389/div2/boxes_of_books.py
class BoxesOfBooks:
    def boxes(self, weights, maxWeight):
        c, p = 0, 0
        for w in weights:
            if w > p:
                c += 1
                p = maxWeight
            p -= w
        return c

class BoxesOfBooks:
    def boxes(self, weights, maxWeight):
        c, p = 0, 0
        for w in weights:
            if w > p:
                c += 1
                p = maxWeight
            p -= w
        return c