Problem: you have to send 3000 grapes 1000 kilometers from grapecity to appleland . your truck can carry 1000 grapes at a time . every time you travel a kilometer towards appleland you must pay a tax of 1 grape but you pay nothing when going in the other direction ( towards grapecity ) . what is highest number of grapes you can get to appleland ?
Rationale: step one : first you want to make 3 trips of 1,000 grapes 333 kilometers . you will be left with 2,001 grapes and 667 kilometers to go . step two : next you want to take 2 trips of 1,000 grapes 500 kilometers . you will be left with 1,000 grapes and 167 kilometers to go ( you have to leave a grape behind ) . step three : finally , you travel the last 167 kilometers with one load of 1,000 grapes and are left with 833 grapes in appleland . correct answer is a ) 833
annotated_formula: subtract(1000, subtract(subtract(1000, floor(divide(1000, const_3))), divide(1000, const_2)))