You're basically describing the classical fully polynomial-time approximation scheme for 0-1 knapsack. I think it first appeared in the 1979 paper "Fast approximation algorithms for knapsack problems" by Eugene L Lawler.