This problem is in Contest(s) below:
Contest 1147:GESP C++ 2024年9月一级到四级编程题
Contest 1176:GESP三级考试编程第一题汇总
Contest 1178:小测试