This problem is in Contest(s) below:
Contest 1043:14级新生周赛(1)
Contest 1105:程序设计与ACM竞赛实训