This problem is in Contest(s) below:
Contest 1233:暑期C++编程训练A5
Contest 1234:暑期C++编程训练B5