Need help with dynamic programming problem
Posted
by John Retallack
on Stack Overflow
See other posts from Stack Overflow
or by John Retallack
Published on 2010-04-08T22:30:25Z
Indexed on
2010/04/08
22:33 UTC
Read the original article
Hit count: 502
I have the following problem : I am given a tree with N apples, for each apple I am given it's weight and height,I can pick apples up to a given height H,each time I pick an apple the height of every apple is increased with U(also given).I have to find out the maximum weight of apples I can pick.
e.g:
N=4 H=100 U=10
(height-eight)
apple1: 91 10
apple2: 82 30
apple3: 93 5
apple4: 94 15
The answer is 45 : I first pick the apple with the weight of 15 then the one with the weight of 30.
I would like to know if someone here could help me with giving me an hint on how I should approach this problem.
Thank you.
© Stack Overflow or respective owner