Answer: (2 + (b-c)/c) + (2 + (b-c)/c) + (1 + (a-b)/c) + (b+c)/a (of course, using integer arithmetic only. no fractions)
Without loss of generality, we can assume (as George has done) a >= b >= c. The layout will be taken as (a+b) x (a+c) x (b+c) in x,y and z directions. A simple greedy stacking will try to keep axb on floor (x,y plane) as far as possible. Then axc, followed by bxc on floor.
- axb on floor at origin. Stack along z axis. Total number = (b+c)/c = 2+(b-c)/c.
- bxa on floor at starting at (a,0,0). Stack along z axis. Total number = (b+c)/c = 2+(b-c)/c
- axc on floor starting at (0,a+c,0) Stack along y axis inwards. (height b now). Total number = 1 + (a-b)/c. Note: a-b is the space left of after 1 along y axis.
- The last block bxc on floor starting at (a+b,a+c,0), the last bottom corner. Try stacking something with height a along z axis. Total number = (b+c)/a
So, minimum 5.
Depending on values of a,b and c more can be fit.
Example, 5,3,1 according to this strategy fits (2+2)+(2+2)+(1+2)+0 = 12
The same with 5,3,2 fits (2+0)+(2+0)+(1+1)+1 = 7. The last 1 is a bonus 2+3=5 (b+c=a).
Edit: While the overall steps remain the same, The solution wasn't fully greedy enough. Real greedy would repeat step 1 (a+c)/b times starting at (0,0,0), (0,b,0), (0,2b,0) etc. This leaves step 3 for (a+c)%b times. So answer is
(a+c)/b [2+(b-c)/c] + [2+(b-c)/c] + [(a+c)%b]/c + (b+c)/a