This problem is in Contest(s) below:
Contest 1160:GESP一级考试编程第二题汇总
Contest 1156:GESP C++ 2025年3月一级到四级