On optimal allocation of a continuous resource using an iterative approach and total positivity