hi, problems here.

a person go to buy heavy things n put into his troly. there have 10 . No matter how many times he come just take all the 10 . The function need to put at things there to count how many he already take n left how many.for troly , if take 3 n over the troly will walk slowly than if he take 2 only.

if use probability it contains many .So have any idea to shortcut it .