in reply to The Best fit by capacity of Box

Answering a question by asking Questions...

if 1st choice (400 of each book):

I propose for each book ($qty=400?)
  1. Get number of schools needing it $n
  2. min books per school $bps= int($qty/$n);
  3. get extra books $extra=$qty-$bps*$n;
  4. give 1 extra book to schools (start alphabetically)

if 2nd choice (400 books/box, many boxes/school):

I think yu could probably use statistics... evaluate the needs of each school.... do you need an exact solution? do you have time to bruteforce it?