https://www.codechef.com/viewsolution/52008125

So what I tried was to get answer by applying the logic of if the sum of size of boxes completely divides by the size of the bag which meant I could directly print the quotient which would give me the answer else I could add 1 to the quotient for all other cases meaning one extra bag was required.