This problem is in Contest(s) below:
Contest 1381:暑假背包训练
Contest 1444:Dp入门
Contest 1153:DP入门
Contest 1270:Dp入门及记忆化搜索
Contest 1398:test2_YC
Contest 1258:抓住假期小尾巴,打字手感练起来
Contest 1050:寒假训练2
Contest 1441:YC-NOIP普及