This problem is in Contest(s) below:
Contest 1225:暑期C++编程训练A1
Contest 1226:暑期C++编程训练B1