This problem is in Contest(s) below:
Contest 5230:初识穷举法