This problem is in Contest(s) below:
Contest 1834:七年级贪心训练
Contest 1987:算法基础班结业测试