This problem is in Contest(s) below:
Contest 1003:分支程序设计(二)