This problem is in Contest(s) below:
Contest 1997:贪心练习