This problem is in Contest(s) below:
Contest 1295:动态规划1
Contest 1360:背包问题