正文 具体思路 直接将间隔的长度存入 L 数组,然后排序,循环 n-m 次将长度累计至 res,最后输出 res+m 即可。 代码 #include <cstdio> #include <algorithm> using namespace std; const int MAXN = 15000;