This problem is in Contest(s) below:
Contest 1870:19暑假7
Contest 1806:c++中级1班第9课练习