This problem is in Contest(s) below:
Contest 1467:组合数学入门
Contest 1470:组合数学进阶
Contest 1465:Dp入门