This problem is in Contest(s) below:
Contest 1939:数组基础练习(3)
Contest 1053:基础7-30
Contest 1995:零基础第五节