This problem is in Contest(s) below:
Contest 1176:GESP三级考试编程第一题汇总
Contest 1126:CCF GESP2023年9月认证二级-六级编程题