This problem is in Contest(s) below:
Contest 1278:ACM训练题 二(大二)