the supply of boxes is in volumes of $\displaystyle 1, 3, 9, 27,$ and $\displaystyle 81, m^3$

Given that the boxes must be filled completely, what is the least number of boxes that will hold exactly 300 cubic meters of sand?

I tried just guessing thru this but there must be method of deriving it.

$\displaystyle

300-([3]\times81)=243\rightarrow300-243=57\rightarrow57-([2]\times27)=1\rightarrow[1]-1=0

$

so $\displaystyle 3+2+1 = \boxed{6}$boxes