I have a sequence of items $1\leq i \leq n$ that arrive to me one at a time. Each item has a weight $w_i\geq 0$. If I pick up one item, I will not be allowed to pick up any of the next $k$ items ($k< n$). The question is: how can I optimally pick up items, such that the sum of the weights of the chosen items is maximized? There is no other constraint.
The online version of this problem is that I don't know about the weights of the items arriving in the future. The offline version is that I know in advance the weight of every item and their arrival sequence. The problem looks familiar but I am having trouble recall the solution to it. Is there a name/reference for this type of problems? Thanks!