This problem is in Contest(s) below:
Contest 1141:CSP培训班练习题(二)
Contest 1452:第二次训练
Contest 1449:训练五