This problem is in Contest(s) below:
Contest 1152:CSP培训班练习题(五)
Contest 1451:训练六