This problem is in Contest(s) below:
Contest 1077:C++模拟机试题2
Contest 1079:2113-2114班第16周上机作业